commit 22e2e98adcd07c27510c7c21ac602f6f26b0d62a Author: Damian Johnson atagar@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))
tor-commits@lists.torproject.org