MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / stop

Method stop

test/functional/test_framework/socks5.py:326–346  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

324 self.thread.start()
325
326 def stop(self):
327 self.set_running(False)
328 # connect to self to end run loop
329 s = socket.socket(self.conf.af)
330 s.connect(self.conf.addr)
331 s.close()
332 self.thread.join()
333 # if there are active handlers, close them
334 with self._handlers_lock:
335 items = list(self._handlers)
336 for i, item in enumerate(items):
337 if item is None:
338 continue
339 thread, conn = item
340 # check if thread is still active
341 if not try_join_daemon_thread(thread, timeout=0):
342 conn.wakeup()
343 if try_join_daemon_thread(thread, timeout=2):
344 logger.debug(f"Stop(): Handler {i} thread joined")
345 else:
346 logger.warning(f"Stop(): Handler thread {i} didn't finish after force close")
347
348def start_socks5_server(destinations_factory):
349 config = Socks5Configuration()

Callers 4

run_testMethod · 0.95
run_testMethod · 0.45
run_testMethod · 0.45
stop_nodeMethod · 0.45

Calls 7

set_runningMethod · 0.95
try_join_daemon_threadFunction · 0.85
joinMethod · 0.80
wakeupMethod · 0.80
enumerateFunction · 0.50
connectMethod · 0.45
closeMethod · 0.45

Tested by 1

stop_nodeMethod · 0.36