[tor-commits] [stem/master] Fix timeout handling

atagar at torproject.org atagar at torproject.org
Mon May 14 01:04:44 UTC 2018


commit 60f034ad8b9c3aa48e7e2ecb0a2e159b6ed5bc71
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun May 13 17:49:40 2018 -0700

    Fix timeout handling
    
    Oops! Great catch from pastly on #26056 that I buggered up this check. :P
---
 stem/control.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index d10989af..c045eba4 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -4026,14 +4026,14 @@ def _get_with_timeout(event_queue, timeout, start_time):
   """
 
   if timeout:
-    time_left = time.time() - start_time - timeout
+    time_left = timeout - (time.time() - start_time)
 
     if time_left <= 0:
       raise stem.Timeout('Reached our %0.1f second timeout' % timeout)
 
     try:
-      return event_queue.get(time_left)
-    except event_queue.Queue.Empty:
+      return event_queue.get(True, time_left)
+    except queue.Empty:
       raise stem.Timeout('Reached our %0.1f second timeout' % timeout)
   else:
     return event_queue.get()



More information about the tor-commits mailing list