commit 7da10157bda24cb94a6342af4c32b206bd77f5e0 Author: Damian Johnson atagar@torproject.org Date: Mon Oct 28 12:14:09 2013 -0700
Don't attempt to get process information without a pid
Making the resource and connection trackers no-ops when we're unable to determine tor's pid. --- arm/util/tracker.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/arm/util/tracker.py b/arm/util/tracker.py index 4f22dee..c982114 100644 --- a/arm/util/tracker.py +++ b/arm/util/tracker.py @@ -121,10 +121,13 @@ class Daemon(threading.Thread): continue # done waiting, try again
with self._daemon_lock: - is_successful = self._task(self._process_pid, self._process_name) + if self._process_pid is not None: + is_successful = self._task(self._process_pid, self._process_name) + else: + is_successful = False
- if is_successful: - self._run_counter += 1 + if is_successful: + self._run_counter += 1
self._last_ran = time.time()
@@ -132,6 +135,9 @@ class Daemon(threading.Thread): """ Task the resolver is meant to perform. This should be implemented by subclasses. + + :param int process_pid: pid of the process we're tracking + :param str process_name: name of the process we're tracking """
pass
tor-commits@lists.torproject.org