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

[tor-commits] [sbws/master] Make CircuitBuilder use the same RelayList as everyone else



commit ada85cb62efd5f918bd379b5b71173f24553735c
Author: Matt Traudt <sirmatt@xxxxxxx>
Date:   Fri Jun 22 09:51:38 2018 -0400

    Make CircuitBuilder use the same RelayList as everyone else
    
    This reduces the number of copies of relay descriptors we have to keep
    in memory and how frequently we stop to refresh those descriptors.
---
 sbws/core/scanner.py       | 2 +-
 sbws/lib/circuitbuilder.py | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index 6af1b0c..25c1dd3 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -347,8 +347,8 @@ def run_speedtest(args, conf):
             'even lead to messed up results.', conf['tor']['control_socket'])
         time.sleep(15)
     assert stem_utils.is_controller_okay(controller)
-    cb = CB(args, conf, controller)
     rl = RelayList(args, conf, controller)
+    cb = CB(args, conf, controller, rl)
     rd = ResultDump(args, conf, end_event)
     rp = RelayPrioritizer(args, conf, rl, rd)
     destinations, error_msg = DestinationList.from_config(
diff --git a/sbws/lib/circuitbuilder.py b/sbws/lib/circuitbuilder.py
index 33df6ec..d55b929 100644
--- a/sbws/lib/circuitbuilder.py
+++ b/sbws/lib/circuitbuilder.py
@@ -2,7 +2,7 @@ from stem import CircuitExtensionFailed, InvalidRequest, ProtocolError, Timeout
 from stem import InvalidArguments
 import random
 import sbws.util.stem as stem_utils
-from .relaylist import Relay, RelayList
+from .relaylist import Relay
 import logging
 
 log = logging.getLogger(__name__)
@@ -39,10 +39,11 @@ class CircuitBuilder:
     them, but CircuitBuilder will keep track of existing circuits and close
     them when it is deleted.
     '''
-    def __init__(self, args, conf, controller, close_circuits_on_exit=True):
+    def __init__(self, args, conf, controller, relay_list,
+                 close_circuits_on_exit=True):
         self.controller = controller
         self.rng = random.SystemRandom()
-        self.relay_list = RelayList(args, conf, self.controller)
+        self.relay_list = relay_list
         self.built_circuits = set()
         self.close_circuits_on_exit = close_circuits_on_exit
         self.circuit_timeout = conf.getint('general', 'circuit_timeout')



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