[tor-commits] [sbws/master] scanner: create global variables launching threads

juga at torproject.org juga at torproject.org
Mon Feb 4 14:57:14 UTC 2019


commit 66ee7406733e5656528b2ea426403facba116b18
Author: juga0 <juga at riseup.net>
Date:   Tue Jan 8 15:53:59 2019 +0000

    scanner: create global variables launching threads
    
    so that the objects that manage the threads can be stop at any
    time.
---
 sbws/core/scanner.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sbws/core/scanner.py b/sbws/core/scanner.py
index bf6d660..b926149 100644
--- a/sbws/core/scanner.py
+++ b/sbws/core/scanner.py
@@ -24,6 +24,11 @@ from .. import settings
 
 rng = random.SystemRandom()
 log = logging.getLogger(__name__)
+# Declare the objects that manage the threads global so that sbws can exit
+# gracefully at any time.
+pool = None
+rd = None
+controller = None
 
 
 def timed_recv_from_server(session, dest, byte_range):
@@ -329,6 +334,7 @@ def result_putter_error(target):
 
 
 def run_speedtest(args, conf):
+    global rd, pool, controller
     controller, _ = stem_utils.init_controller(
         path=conf.getpath('tor', 'control_socket'))
     if not controller:





More information about the tor-commits mailing list