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

[tor-commits] [stem/master] More eagerly invalidate our exit policy cache



commit 720164398b847dfedde9e2dc9de7a6eb85c18de8
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Apr 17 09:19:17 2018 -0700

    More eagerly invalidate our exit policy cache
    
    Lots of great points on #25423. There's several torrc options that can adjust
    our exit policy so simply invalidating it with any SETCONF call. It's cheap to
    reconstruct the ExitPolicy instance anyway.
---
 stem/control.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 93f8fc19..ed869a8c 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -1072,8 +1072,7 @@ class Controller(BaseController):
       if self.is_caching_enabled():
         self._set_cache(dict((k, None) for k in event.config), 'getconf')
 
-        if 'exitpolicy' in event.config.keys():
-          self._set_cache({'exit_policy': None})
+        self._set_cache({'exit_policy': None})  # numerous options can change our policy
 
     self.add_event_listener(_confchanged_listener, EventType.CONF_CHANGED)
 
@@ -2410,9 +2409,7 @@ class Controller(BaseController):
 
           to_cache[param] = value
 
-          if param == 'exitpolicy':
-            self._set_cache({'exit_policy': None})
-          elif 'hidden' in param:
+          if 'hidden' in param:
             self._set_cache({'hidden_service_conf': None})
 
         # reset any getinfo parameters that can be changed by a SETCONF
@@ -2422,6 +2419,8 @@ class Controller(BaseController):
 
         self._set_cache(to_cache, 'getconf')
         self._set_cache({'get_custom_options': None})
+
+        self._set_cache({'exit_policy': None})  # numerous options can change our policy
     else:
       log.debug('%s (failed, code: %s, message: %s)' % (query, response.code, response.message))
       immutable_params = [k for k, v in params if stem.util.str_tools._to_unicode(k).lower() in IMMUTABLE_CONFIG_OPTIONS]



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