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

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



commit 1014bac294d03790c15bec1bff21e9ca9802acdb
Author: juga0 <juga@xxxxxxxxxx>
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):
         """



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