[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Start tracker daemons when they're requested
commit a4c706c3be47fbc531d34860b874c196217c0790
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Mon Jul 27 09:35:39 2015 -0700
Start tracker daemons when they're requested
Why would we want a daemon that isn't running? Presently application resolution
is a no-op because we're talking with a dorment tracker. Lets always give
running instances.
We were also failing to stop one of the trackers, and this tweaks our check so
we skip trackers that were never requested (and hence don't exist).
---
nyx/controller.py | 1 -
nyx/util/tracker.py | 10 +++++++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/nyx/controller.py b/nyx/controller.py
index 77b2037..35b1e89 100644
--- a/nyx/controller.py
+++ b/nyx/controller.py
@@ -141,7 +141,6 @@ def init_controller(stdscr, start_time):
resolver = nyx.util.tracker.get_connection_tracker()
log.info('Operating System: %s, Connection Resolvers: %s' % (os.uname()[0], ', '.join(resolver._resolvers)))
- resolver.start()
else:
# constructs singleton resolver and, if tor isn't connected, initizes
# it to be paused
diff --git a/nyx/util/tracker.py b/nyx/util/tracker.py
index b122d4b..48697dc 100644
--- a/nyx/util/tracker.py
+++ b/nyx/util/tracker.py
@@ -95,6 +95,7 @@ def get_connection_tracker():
if CONNECTION_TRACKER is None:
CONNECTION_TRACKER = ConnectionTracker(CONFIG['queries.connections.rate'])
+ CONNECTION_TRACKER.start()
return CONNECTION_TRACKER
@@ -108,6 +109,7 @@ def get_resource_tracker():
if RESOURCE_TRACKER is None:
RESOURCE_TRACKER = ResourceTracker(CONFIG['queries.resources.rate'])
+ RESOURCE_TRACKER.start()
return RESOURCE_TRACKER
@@ -121,6 +123,7 @@ def get_port_usage_tracker():
if PORT_USAGE_TRACKER is None:
PORT_USAGE_TRACKER = PortUsageTracker(CONFIG['queries.port_usage.rate'])
+ PORT_USAGE_TRACKER.start()
return PORT_USAGE_TRACKER
@@ -146,9 +149,10 @@ def stop_trackers():
"""
def halt_trackers():
- trackers = filter(lambda t: t.is_alive(), [
- get_resource_tracker(),
- get_connection_tracker(),
+ trackers = filter(lambda t: t and t.is_alive(), [
+ CONNECTION_TRACKER,
+ RESOURCE_TRACKER,
+ PORT_USAGE_TRACKER,
])
for tracker in trackers:
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits