[tor-commits] [sbws/master] fix: relaylist: rename can_exit_to_port

juga at torproject.org juga at torproject.org
Tue Feb 23 07:24:15 UTC 2021


commit 1014bac294d03790c15bec1bff21e9ca9802acdb
Author: juga0 <juga at riseup.net>
Date:   Tue Feb 2 11:15:02 2021 +0000

    fix: relaylist: rename can_exit_to_port
    
    to can_exit_to_port_all_ips, because it's using `strict`, which means
    that it allows to exit to all IPs.
    It seems more convenient to try first with exits that allow to
    exit to some IPs and only try a second time if that fails, because
    there are more.
---
 sbws/lib/relaylist.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index ba0b176..5eef4aa 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -178,7 +178,7 @@ class Relay:
         """Number of times the relay was in a conensus."""
         return len(self.relay_in_recent_consensus)
 
-    def can_exit_to_port(self, port):
+    def can_exit_to_port_all_ips(self, port):
         """
         Returns True if the relay has an exit policy and the policy accepts
         exiting to the given portself or False otherwise.
@@ -192,7 +192,7 @@ class Relay:
         # When the attribute is gotten in getattr(self._desc, "exit_policy"),
         # is possible that stem's _input_rules is None and raises an exception
         # (#29899):
-        #   File "/usr/lib/python3/dist-packages/sbws/lib/relaylist.py", line 117, in can_exit_to_port  # noqa
+        #   File "/usr/lib/python3/dist-packages/sbws/lib/relaylist.py", line 117, in can_exit_to_port_all_ips  # noqa
         #     if not self.exit_policy:
         #   File "/usr/lib/python3/dist-packages/stem/exit_policy.py", line 512, in __len__  # noqa
         #     return len(self._get_rules())
@@ -222,7 +222,7 @@ class Relay:
     def is_exit_not_bad_allowing_port(self, port):
         return (Flag.BADEXIT not in self.flags and
                 Flag.EXIT in self.flags and
-                self.can_exit_to_port(port))
+                self.can_exit_to_port_all_ips(port))
 
     def increment_relay_recent_measurement_attempt(self):
         """





More information about the tor-commits mailing list