[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [arm/master] Moving torrc sighup reloads to the torrc panel
commit 7fbbbad2e682d617157bd931ce18c1bcd3504ead
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Fri May 13 19:29:00 2011 -0700
Moving torrc sighup reloads to the torrc panel
Using the new style listeners for torrc sighup listening rather than the old
sighup tracker.
---
src/cli/controller.py | 9 ---------
src/cli/torrcPanel.py | 20 +++++++++++++++++++-
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/cli/controller.py b/src/cli/controller.py
index 5696daa..63f62e5 100644
--- a/src/cli/controller.py
+++ b/src/cli/controller.py
@@ -432,15 +432,6 @@ def drawTorMonitor(stdscr, startTime, loggedEvents, isBlindMode):
if panels["graph"].currentDisplay == "bandwidth":
panels["graph"].setHeight(panels["graph"].stats["bandwidth"].getContentHeight())
- # TODO: should redraw the torrcPanel
- #panels["torrc"].loadConfig()
-
- # reload the torrc if it's previously been loaded
- if loadedTorrc.isLoaded():
- try:
- loadedTorrc.load(True)
- if page == 3: panels["torrc"].redraw(True)
- except: pass
sighupTracker.isReset = False
diff --git a/src/cli/torrcPanel.py b/src/cli/torrcPanel.py
index af6f4d6..e14a16a 100644
--- a/src/cli/torrcPanel.py
+++ b/src/cli/torrcPanel.py
@@ -8,7 +8,7 @@ import threading
import popups
-from util import conf, enum, panel, torConfig, uiTools
+from util import conf, enum, panel, torConfig, torTools, uiTools
DEFAULT_CONFIG = {"features.config.file.showScrollbars": True,
"features.config.file.maxLinesPerEntry": 8}
@@ -40,6 +40,24 @@ class TorrcPanel(panel.Panel):
# _lastContentHeightArgs is None or differs from the current dimensions)
self._lastContentHeight = 1
self._lastContentHeightArgs = None
+
+ # listens for tor reload (sighup) events
+ torTools.getConn().addStatusListener(self.resetListener)
+
+ def resetListener(self, conn, eventType):
+ """
+ Reloads and displays the torrc on tor reload (sighup) events.
+
+ Arguments:
+ conn - tor controller
+ eventType - type of event detected
+ """
+
+ if eventType == torTools.State.INIT:
+ try:
+ torConfig.getTorrc().load(True)
+ self.redraw(True)
+ except: pass
def handleKey(self, key):
self.valsLock.acquire()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits