Loading sbws/core/scanner.py +21 −0 Original line number Diff line number Diff line ''' Measure the relays. ''' import signal import sys from ..lib.circuitbuilder import GapsCircuitBuilder as CB from ..lib.resultdump import ResultDump from ..lib.resultdump import ResultSuccess, ResultErrorCircuit Loading Loading @@ -31,6 +34,24 @@ rd = None controller = None def stop_threads(signal, frame): global rd, pool log.debug('Stopping sbws.') # Avoid new threads to start. settings.set_end_event() # Stop Pool threads pool.close() pool.join() # Stop ResultDump thread rd.thread.join() # Stop Tor thread controller.close() sys.exit(0) signal.signal(signal.SIGTERM, stop_threads) def timed_recv_from_server(session, dest, byte_range): ''' Request the **byte_range** from the URL at **dest**. If successful, return True and the time it took to download. Otherwise return False and an Loading Loading
sbws/core/scanner.py +21 −0 Original line number Diff line number Diff line ''' Measure the relays. ''' import signal import sys from ..lib.circuitbuilder import GapsCircuitBuilder as CB from ..lib.resultdump import ResultDump from ..lib.resultdump import ResultSuccess, ResultErrorCircuit Loading Loading @@ -31,6 +34,24 @@ rd = None controller = None def stop_threads(signal, frame): global rd, pool log.debug('Stopping sbws.') # Avoid new threads to start. settings.set_end_event() # Stop Pool threads pool.close() pool.join() # Stop ResultDump thread rd.thread.join() # Stop Tor thread controller.close() sys.exit(0) signal.signal(signal.SIGTERM, stop_threads) def timed_recv_from_server(session, dest, byte_range): ''' Request the **byte_range** from the URL at **dest**. If successful, return True and the time it took to download. Otherwise return False and an Loading