[tor-commits] [arm/master] fix: newnym without a tor instance crashed

atagar at torproject.org atagar at torproject.org
Thu Jun 30 03:32:10 UTC 2011


commit 788b34d214fc1532c444a4c97d54fabc71c3e18d
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Jun 29 20:28:48 2011 -0700

    fix: newnym without a tor instance crashed
    
    If we've never had a tor instance then a missing attribute could cause arm to
    crash when a newnym was requested. Also, we shouldn't be indicating that
    newnym is available if there's no tor instance. Fixed both.
---
 src/util/torTools.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/util/torTools.py b/src/util/torTools.py
index c44160e..7e9fa37 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -336,6 +336,7 @@ class Controller(TorCtl.PostEventListener):
     self._isReset = False               # internal flag for tracking resets
     self._status = State.CLOSED         # current status of the attached control port
     self._statusTime = 0                # unix time-stamp for the duration of the status
+    self._lastNewnym = 0                # time we last sent a NEWNYM signal
     self.lastHeartbeat = 0              # time of the last tor event
     
     # Status signaling for when tor starts, stops, or is reset is done via
@@ -742,7 +743,9 @@ class Controller(TorCtl.PostEventListener):
     True if Tor will immediately respect a newnym request, false otherwise.
     """
     
-    return self.getNewnymWait() == 0
+    if self.isAlive():
+      return self.getNewnymWait() == 0
+    else: return False
   
   def getNewnymWait(self):
     """



More information about the tor-commits mailing list