commit dbfd2691b28e768d34e1e2abe2c072fa37f5199e Author: Damian Johnson atagar@torproject.org Date: Sun Jan 26 19:49:08 2014 -0800
Finish moving header off tor_tools
Replacing our last couple tor_tools calls with Controller counterparts. --- arm/header_panel.py | 19 +++++++++++++++---- arm/util/tor_tools.py | 11 ----------- 2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/arm/header_panel.py b/arm/header_panel.py index fbd3d92..6232da3 100644 --- a/arm/header_panel.py +++ b/arm/header_panel.py @@ -23,13 +23,13 @@ import arm.util.tracker
from stem import Signal from stem.control import State -from stem.util import conf, log, proc, str_tools +from stem.util import conf, log, proc, str_tools, system
import arm.starter import arm.popups import arm.controller
-from util import panel, tor_tools, ui_tools, tor_controller +from util import panel, ui_tools, tor_controller
# minimum width for which panel attempts to double up contents (two columns to # better use screen real estate) @@ -608,7 +608,11 @@ class HeaderPanel(panel.Panel, threading.Thread):
self.vals["tor/pid"] = controller.get_pid("")
- start_time = tor_tools.get_conn().get_start_time() + try: + start_time = system.get_start_time(controller.get_pid()) + except: + start_time = None + self.vals["tor/start_time"] = start_time if start_time else ""
# reverts volatile parameters to defaults @@ -628,7 +632,14 @@ class HeaderPanel(panel.Panel, threading.Thread): self.vals["tor/address"] = controller.get_info("address", "")
self.vals["tor/fingerprint"] = controller.get_info("fingerprint", self.vals["tor/fingerprint"]) - self.vals["tor/flags"] = tor_tools.get_conn().get_my_flags(self.vals["tor/flags"]) + + my_fingerprint = controller.get_info("fingerprint", None) + + if my_fingerprint: + my_status_entry = controller.get_network_status(my_fingerprint) + + if my_status_entry: + self.vals["tor/flags"] = my_status_entry.flags
# Updates file descriptor usage and logs if the usage is high. If we don't # have a known limit or it's obviously faulty (being lower than our diff --git a/arm/util/tor_tools.py b/arm/util/tor_tools.py index 87033c9..4575616 100644 --- a/arm/util/tor_tools.py +++ b/arm/util/tor_tools.py @@ -454,17 +454,6 @@ class Controller:
return self.controller.get_user(None)
- def get_start_time(self): - """ - Provides the unix time for when the tor process first started. If this - can't be determined then this provides None. - """ - - try: - return system.get_start_time(self.controller.get_pid()) - except: - return None - def is_exiting_allowed(self, ip_address, port): """ Checks if the given destination can be exited to by this relay, returning