[tor-commits] [stem/master] Drop message lock check from get_exit_policy

atagar at torproject.org atagar at torproject.org
Tue Apr 17 16:48:31 UTC 2018


commit 142db72abfd8b2139096d41581e7cad43ac8981c
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Apr 17 09:32:47 2018 -0700

    Drop message lock check from get_exit_policy
    
    Great catch from dmr on #25423. This method is odd in that it's the only one
    using the BaseController's msg_lock. I can't see a reason for this either.
---
 stem/control.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index ed869a8c..a91e9588 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -1283,14 +1283,13 @@ class Controller(BaseController):
       An exception is only raised if we weren't provided a default response.
     """
 
-    with self._msg_lock:
-      policy = self._get_cache('exit_policy')
+    policy = self._get_cache('exit_policy')
 
-      if not policy:
-        policy = stem.exit_policy.ExitPolicy(*self.get_info('exit-policy/full').splitlines())
-        self._set_cache({'exit_policy': policy})
+    if not policy:
+      policy = stem.exit_policy.ExitPolicy(*self.get_info('exit-policy/full').splitlines())
+      self._set_cache({'exit_policy': policy})
 
-      return policy
+    return policy
 
   @with_default()
   def get_ports(self, listener_type, default = UNDEFINED):





More information about the tor-commits mailing list