added watchdog, use it to kill tor

This commit is contained in:
Kevin Froman 2019-12-09 05:02:37 -06:00
parent 63c0c51f38
commit 15872f8f7c
5 changed files with 56 additions and 2 deletions

View file

@ -77,7 +77,7 @@ class SubprocessPOW:
"""spawn the multiproc handler threads"""
# Create a new thread for each subprocess
for _ in range(self.subproc_count): # noqa
threading.Thread(target=self._spawn_proc).start()
threading.Thread(target=self._spawn_proc, daemon=True).start()
# Monitor the processes for a payload, shut them down when its found
while True:
if self.payload is None:
@ -90,7 +90,7 @@ class SubprocessPOW:
"""Create a child proof of work process
wait for data and send shutdown signal when its found"""
parent_conn, child_conn = Pipe()
p = Process(target=self.do_pow, args=(child_conn,))
p = Process(target=self.do_pow, args=(child_conn,), daemon=True)
p.start()
p.join()
payload = None