[tor-commits] [nyx/master] Drop log panel's state listener

atagar at torproject.org atagar at torproject.org
Tue May 5 05:42:06 UTC 2015


commit b6df5ccc52286d197423506cd8be0155ecfeaa89
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Apr 29 08:54:29 2015 -0700

    Drop log panel's state listener
    
    All it did now was log a message saying we're disconnected from tor. We have
    lots of other state listeners laying around and can just as well be part of one
    of those.
---
 nyx/controller.py |    4 +++-
 nyx/log_panel.py  |   11 -----------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/nyx/controller.py b/nyx/controller.py
index f94bf11..6225038 100644
--- a/nyx/controller.py
+++ b/nyx/controller.py
@@ -500,7 +500,9 @@ def conn_reset_listener(controller, event_type, _):
   if resolver.is_alive():
     resolver.set_paused(event_type == State.CLOSED)
 
-    if event_type in (State.INIT, State.RESET):
+    if event_type == State.CLOSED:
+      log.notice('Tor control port closed')
+    elif event_type in (State.INIT, State.RESET):
       # Reload the torrc contents. If the torrc panel is present then it will
       # do this instead since it wants to do validation and redraw _after_ the
       # new contents are loaded.
diff --git a/nyx/log_panel.py b/nyx/log_panel.py
index 44a2b2a..a592e56 100644
--- a/nyx/log_panel.py
+++ b/nyx/log_panel.py
@@ -13,7 +13,6 @@ import threading
 import stem
 import stem.response.events
 
-from stem.control import State
 from stem.util import conf, log, str_tools
 
 import nyx.arguments
@@ -155,16 +154,6 @@ class LogPanel(panel.Panel, threading.Thread):
 
     self.last_content_height = len(self._msg_log)
 
-    # adds listeners for tor and stem events
-
-    controller = tor_controller()
-
-    def reset_listener(controller, event_type, _):
-      if event_type == State.CLOSED:
-        log.notice('Tor control port closed')
-
-    controller.add_status_listener(reset_listener)
-
   def set_duplicate_visability(self, is_visible):
     """
     Sets if duplicate log entries are collaped or expanded.





More information about the tor-commits mailing list