[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r22476: {arm} fix: stopping connection resolution (and related failover me (arm/trunk/interface)



Author: atagar
Date: 2010-06-06 02:15:01 +0000 (Sun, 06 Jun 2010)
New Revision: 22476

Modified:
   arm/trunk/interface/controller.py
   arm/trunk/interface/logPanel.py
Log:
fix: stopping connection resolution (and related failover message) when tor's stopped



Modified: arm/trunk/interface/controller.py
===================================================================
--- arm/trunk/interface/controller.py	2010-06-06 00:31:54 UTC (rev 22475)
+++ arm/trunk/interface/controller.py	2010-06-06 02:15:01 UTC (rev 22476)
@@ -288,6 +288,16 @@
   returnVal.sort() # alphabetizes
   return returnVal
 
+def connResetListener(conn, eventType):
+  """
+  Pauses connection resolution when tor's shut down, and resumes if started
+  again.
+  """
+  
+  if connections.isResolverAlive("tor"):
+    resolver = connections.getResolver("tor")
+    resolver.setPaused(eventType == torTools.TOR_CLOSED)
+
 def drawTorMonitor(stdscr, loggedEvents, isBlindMode):
   """
   Starts arm interface reflecting information on provided control port.
@@ -298,6 +308,9 @@
     otherwise unrecognized events)
   """
   
+  # pauses/unpauses connection resolution according to if tor's connected or not
+  torTools.getConn().addStatusListener(connResetListener)
+  
   # TODO: incrementally drop this requirement until everything's using the singleton
   conn = torTools.getConn().getTorCtl()
   

Modified: arm/trunk/interface/logPanel.py
===================================================================
--- arm/trunk/interface/logPanel.py	2010-06-06 00:31:54 UTC (rev 22475)
+++ arm/trunk/interface/logPanel.py	2010-06-06 02:15:01 UTC (rev 22476)
@@ -31,8 +31,8 @@
         w WARN      f DESCCHANGED     s STREAM          z STATUS_SERVER
         e ERR       g GUARD           t STREAM_BW       A All Events
                     k NEWCONSENSUS    u CLIENTS_SEEN    X No Events
-          DINWE Runlevel and higher severity            C TorCtl Events
-          12345 ARM runlevel and higher severity        U Unknown Events"""
+          DINWE runlevel and higher severity            C TorCtl Events
+          12345 arm runlevel and higher severity        U Unknown Events"""
 
 TOR_CTL_CLOSE_MSG = "Tor closed control connection. Exiting event thread."