[tor-commits] [sbws/master] fix: scanner: remove relay to measure as helper

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


commit 50377680448d66bc95a09fc5333da9465bd1b791
Author: juga0 <juga at riseup.net>
Date:   Mon Feb 8 16:24:11 2021 +0000

    fix: scanner: remove relay to measure as helper
---
 sbws/core/scanner.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index c7ee1ee..40e3093 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -219,6 +219,12 @@ def _pick_ideal_second_hop(relay, dest, rl, cont, is_exit):
         if is_exit else rl.non_exits
     if not len(candidates):
         return None
+    # In the case the helper is an exit, the entry could be an exit too
+    # (#40041), so ensure the helper is not the same as the entry, likely to
+    # happen in a test network.
+    if is_exit:
+        candidates = [c for c in candidates
+                      if c.fingerprint != relay.fingerprint]
     min_relay_bw = rl.exit_min_bw() if is_exit else rl.non_exit_min_bw()
     log.debug('Picking a 2nd hop to measure %s from %d choices. is_exit=%s',
               relay.nickname, len(candidates), is_exit)





More information about the tor-commits mailing list