[tor-commits] [arm/master] Using stem to send remaining signals

atagar at torproject.org atagar at torproject.org
Mon Dec 17 04:25:17 UTC 2012


commit 0c1ee97cd1edeed9141ce9c78c6a5db953bf242e
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Dec 16 18:56:31 2012 -0800

    Using stem to send remaining signals
    
    On first look this is the last of our TorCtl connection usage. Hazaa!
---
 src/util/torTools.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/util/torTools.py b/src/util/torTools.py
index 0875a05..056c454 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -13,6 +13,7 @@ import threading
 import Queue
 
 import stem
+import stem.control
 from TorCtl import TorCtl
 
 from util import connections, enum, log, procTools, sysTools, uiTools
@@ -1450,7 +1451,7 @@ class Controller(TorCtl.PostEventListener):
     if self.isAlive():
       if not issueSighup:
         try:
-          self.conn.send_signal("RELOAD")
+          self.controller.signal(stem.Signal.RELOAD)
           self._cachedParam = {}
         except Exception, exc:
           # new torrc parameters caused an error (tor's likely shut down)
@@ -1519,8 +1520,11 @@ class Controller(TorCtl.PostEventListener):
     if self.isAlive():
       try:
         isRelay = self.getOption("ORPort", None) != None
-        signal = "HALT" if force else "SHUTDOWN"
-        self.conn.send_signal(signal)
+        
+        if force:
+          stem.controller.signal(stem.Signal.HALT)
+        else:
+          stem.controller.signal(stem.Signal.SHUTDOWN)
         
         # shuts down control connection if we aren't making a delayed shutdown
         if force or not isRelay: self.close()





More information about the tor-commits mailing list