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

[tor-commits] [arm/master] Dropping getControllerEvents() method



commit 8209df0b75fc12ea1d6272dd79d47867c2932327
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Jun 1 20:04:01 2013 -0700

    Dropping getControllerEvents() method
    
    The getControllerEvents() method was broken because arm's Controller no longer
    tracks event listening. On reflection though it's also unneeded since it's sole
    caller is checking for BW events. The graph panel requres those so they'll
    always be present unless the user opted to drop the graph (possible, but not
    done in practice).
    
    This also cleans up some unused attributes and imports.
---
 src/cli/controller.py |    2 +-
 src/util/torTools.py  |   17 -----------------
 2 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/src/cli/controller.py b/src/cli/controller.py
index 54ea613..58bd41d 100644
--- a/src/cli/controller.py
+++ b/src/cli/controller.py
@@ -470,7 +470,7 @@ def heartbeatCheck(isUnresponsive):
   
   conn = torTools.getConn()
   lastHeartbeat = conn.controller.get_latest_heartbeat()
-  if conn.isAlive() and "BW" in conn.getControllerEvents():
+  if conn.isAlive():
     if not isUnresponsive and (time.time() - lastHeartbeat) >= 10:
       isUnresponsive = True
       log.notice("Relay unresponsive (last heartbeat: %s)" % time.ctime(lastHeartbeat))
diff --git a/src/util/torTools.py b/src/util/torTools.py
index d6e1220..21f94b4 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -4,12 +4,9 @@ accessing stem and notifications of state changes to subscribers.
 """
 
 import os
-import pwd
 import time
 import math
-import thread
 import threading
-import Queue
 
 import stem
 import stem.control
@@ -20,15 +17,10 @@ from util import connections
 
 from stem.util import conf, enum, log, proc, str_tools, system
 
-# message logged by default when a controller can't set an event type
-DEFAULT_FAILED_EVENT_MSG = "Unsupported event type: %s"
-
 CONTROLLER = None # singleton Controller instance
 
 UNDEFINED = "<Undefined_ >"
 
-UNKNOWN = "UNKNOWN" # value used by cached information if undefined
-
 CONFIG = conf.config_dict("arm", {
   "features.pathPrefix": "",
 })
@@ -59,14 +51,12 @@ class Controller:
   def __init__(self):
     self.controller = None
     self.connLock = threading.RLock()
-    self.controllerEvents = []          # list of successfully set controller events
     self._fingerprintMappings = None    # mappings of ip -> [(port, fingerprint), ...]
     self._fingerprintLookupCache = {}   # lookup cache with (ip, port) -> fingerprint mappings
     self._nicknameLookupCache = {}      # lookup cache with fingerprint -> nickname mappings
     self._addressLookupCache = {}       # lookup cache with fingerprint -> (ip address, or port) mappings
     self._consensusLookupCache = {}     # lookup cache with network status entries
     self._descriptorLookupCache = {}    # lookup cache with relay descriptors
-    self._isReset = False               # internal flag for tracking resets
     self._lastNewnym = 0                # time we last sent a NEWNYM signal
     
     # Logs issues and notices when fetching the path prefix if true. This is
@@ -865,13 +855,6 @@ class Controller:
     
     self.controller.add_status_listener(callback)
   
-  def getControllerEvents(self):
-    """
-    Provides the events the controller's currently configured to listen for.
-    """
-    
-    return list(self.controllerEvents)
-  
   def reload(self):
     """
     This resets tor (sending a RELOAD signal to the control port) causing tor's

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits