[tor-commits] [sbws/maint-1.1] fix: scanner: Retry to measure exit as exit

juga at torproject.org juga at torproject.org
Tue Dec 15 13:52:00 UTC 2020


commit 033603a607a8aede9ba4496b029d2545808e560e
Author: juga0 <juga at riseup.net>
Date:   Sun Dec 13 13:04:27 2020 +0000

    fix: scanner: Retry to measure exit as exit
    
    if it fails to be measured as entry.
    
    Mayb closes: #40029.
---
 sbws/core/scanner.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index 8b6a6a4..5e6cac3 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -318,6 +318,17 @@ def measure_relay(args, conf, destinations, cb, rl, relay):
 
     # Build the circuit
     circ_id, reason = cb.build_circuit(circ_fps)
+    if not circ_id and relay.fingerprint == circ_fps[0]:
+        # We detected that some exits fail to build circuits as 1st hop.
+        # If that's the case, try again using them as 2nd hop.
+        # We could reuse the helper, but it does not need to be an exit now,
+        # so choose other again.
+        helper = _pick_ideal_second_hop(
+            relay, dest, rl, cb.controller, is_exit=False)
+        if helper:
+            circ_fps = [helper.fingerprint, relay.fingerprint]
+            nicknames = [helper.nickname, relay.nickname]
+        circ_id, reason = cb.build_circuit(circ_fps)
     if not circ_id:
         log.debug('Could not build circuit with path %s (%s): %s ',
                   circ_fps, nicknames, reason)





More information about the tor-commits mailing list