[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Make `Controller.is_user_traffic_allowed` asynchronous



commit 51d216f5ff405a9bd0899d6f6d78f8bdbf52a37d
Author: Illia Volochii <illia.volochii@xxxxxxxxx>
Date:   Fri Apr 17 18:43:01 2020 +0300

    Make `Controller.is_user_traffic_allowed` asynchronous
---
 stem/control.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 47d9cbb3..92172101 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -1683,7 +1683,7 @@ class Controller(BaseController):
 
     return time.time() - (await self.get_start_time())
 
-  def is_user_traffic_allowed(self) -> 'stem.control.UserTrafficAllowed':
+  async def is_user_traffic_allowed(self) -> 'stem.control.UserTrafficAllowed':
     """
     Checks if we're likely to service direct user traffic. This essentially
     boils down to...
@@ -1711,15 +1711,15 @@ class Controller(BaseController):
 
     inbound_allowed, outbound_allowed = False, False
 
-    if self.get_conf('BridgeRelay', None) == '1':
+    if (await self.get_conf('BridgeRelay', None)) == '1':
       inbound_allowed = True
 
-    if self.get_conf('ORPort', None):
+    if await self.get_conf('ORPort', None):
       if not inbound_allowed:
-        consensus_entry = self.get_network_status(default = None)
+        consensus_entry = await self.get_network_status(default = None)
         inbound_allowed = consensus_entry and 'Guard' in consensus_entry.flags
 
-      exit_policy = self.get_exit_policy(None)
+      exit_policy = await self.get_exit_policy(None)
       outbound_allowed = exit_policy and exit_policy.is_exiting_allowed()
 
     return UserTrafficAllowed(inbound_allowed, outbound_allowed)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits