[tor-commits] [onionperf/master] Ensures subprocess shutdown even when things go fast
irl at torproject.org
irl at torproject.org
Tue Feb 26 15:20:55 UTC 2019
commit a0df96a44cd80135605a62309c58b279281e22b8
Author: Ana Custura <ana at nestat.org.uk>
Date: Mon Feb 25 13:34:11 2019 +0100
Ensures subprocess shutdown even when things go fast
In cases where the network delay is minimal, as in a test network,
waiting for 1 second of no log output may mean waiting forever.
---
onionperf/measurement.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/onionperf/measurement.py b/onionperf/measurement.py
index 0c559d9..ff26885 100644
--- a/onionperf/measurement.py
+++ b/onionperf/measurement.py
@@ -67,10 +67,8 @@ def watchdog_thread_task(cmd, cwd, writable, done_ev, send_stdin, ready_search_s
# sure that the subprocess is still alive and the master doesn't want us to quit
while subp.poll() is None and done_ev.is_set() is False:
try:
- # collect lines until the queue is empty for a full second
- while True:
- line = stdout_q.get(True, 1)
- writable.write(line)
+ line = stdout_q.get(True, 1)
+ writable.write(line)
except Queue.Empty:
# the queue is empty and the get() timed out, recheck loop conditions
continue
More information about the tor-commits
mailing list