[tor-commits] [arm/release] fix: closing control connection on shutdown call

atagar at torproject.org atagar at torproject.org
Sun Jul 17 06:08:31 UTC 2011


commit 22e2e98adcd07c27510c7c21ac602f6f26b0d62a
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jul 9 17:23:38 2011 -0700

    fix: closing control connection on shutdown call
    
    Making the shutdown function close the control connection right away if the
    signal should be shutting down tor right away. Without this it was taking
    around five seconds for the connection closure to be reflected in the
    interface.
---
 src/util/torTools.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/util/torTools.py b/src/util/torTools.py
index 0fb71a8..4a18a4f 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -1480,8 +1480,12 @@ class Controller(TorCtl.PostEventListener):
     raisedException = None
     if self.isAlive():
       try:
+        isRelay = self.getOption("ORPort") != None
         signal = "HALT" if force else "SHUTDOWN"
         self.conn.send_signal(signal)
+        
+        # shuts down control connection if we aren't making a delayed shutdown
+        if force or not isRelay: self.close()
       except Exception, exc:
         raisedException = IOError(str(exc))
     





More information about the tor-commits mailing list