[tor-commits] [stem/master] Stopping tor initialization timeout when done

atagar at torproject.org atagar at torproject.org
Mon Jun 25 01:45:02 UTC 2012


commit 54a013552266540d5029af2ff08db2fed1c1dc92
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Jun 24 14:14:49 2012 -0700

    Stopping tor initialization timeout when done
    
    Ok, I'm kinda surprised that we haven't tripped over this before. We never
    terminate the tor initialization timeout on either or success or failure,
    causing us to arbitrarily kill our process after 90 seconds.
    
    This bug probably survived so long becuase our integ tests take less time than
    that to complete, and then spawns a new tor instance resetting the timer again.
---
 stem/process.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/stem/process.py b/stem/process.py
index 337699d..04f787a 100644
--- a/stem/process.py
+++ b/stem/process.py
@@ -104,6 +104,8 @@ def launch_tor(tor_cmd = "tor", args = None, torrc_path = None, completion_perce
     
     # this will provide empty results if the process is terminated
     if not init_line:
+      if timeout: signal.alarm(0) # stop alarm
+      
       # ... but best make sure
       if stem.prereq.is_python_26():
         tor_process.kill()
@@ -120,6 +122,8 @@ def launch_tor(tor_cmd = "tor", args = None, torrc_path = None, completion_perce
     problem_match = problem_line.search(init_line)
     
     if bootstrap_match and int(bootstrap_match.groups()[0]) >= completion_percent:
+      if timeout: signal.alarm(0) # stop alarm
+      
       if temp_file:
         try: os.remove(temp_file)
         except: pass





More information about the tor-commits mailing list