[tor-commits] [arm/master] Dropping getHeartbeat()

atagar at torproject.org atagar at torproject.org
Wed May 29 16:09:35 UTC 2013


commit bb2d38f696c83b185d5938d0ce32a7babcf3853b
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon May 27 22:19:54 2013 -0700

    Dropping getHeartbeat()
    
    Removing our getHeartbeat() method in favor of our controllers.
---
 src/cli/controller.py  |    2 +-
 src/cli/headerPanel.py |    4 ++--
 src/util/torTools.py   |   10 ----------
 3 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/cli/controller.py b/src/cli/controller.py
index 0e45ca9..54ea613 100644
--- a/src/cli/controller.py
+++ b/src/cli/controller.py
@@ -469,7 +469,7 @@ def heartbeatCheck(isUnresponsive):
   """
   
   conn = torTools.getConn()
-  lastHeartbeat = conn.getHeartbeat()
+  lastHeartbeat = conn.controller.get_latest_heartbeat()
   if conn.isAlive() and "BW" in conn.getControllerEvents():
     if not isUnresponsive and (time.time() - lastHeartbeat) >= 10:
       isUnresponsive = True
diff --git a/src/cli/headerPanel.py b/src/cli/headerPanel.py
index 895db01..f1704dc 100644
--- a/src/cli/headerPanel.py
+++ b/src/cli/headerPanel.py
@@ -232,7 +232,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
         self.addstr(1, x, "Relaying Disabled", uiTools.getColor("cyan"))
         x += 17
       else:
-        statusTime = torTools.getConn().getHeartbeat()
+        statusTime = torTools.getConn().controller.get_latest_heartbeat()
         
         if statusTime:
           statusTimeLabel = time.strftime("%H:%M %m/%d/%Y, ", time.localtime(statusTime))
@@ -334,7 +334,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
           self.addstr(y, x, "none", curses.A_BOLD | uiTools.getColor("cyan"))
       else:
         y = 2 if isWide else 4
-        statusTime = torTools.getConn().getHeartbeat()
+        statusTime = torTools.getConn().controller.get_latest_heartbeat()
         statusTimeLabel = time.strftime("%H:%M %m/%d/%Y", time.localtime(statusTime))
         self.addstr(y, 0, "Tor Disconnected", curses.A_BOLD | uiTools.getColor("red"))
         self.addstr(y, 16, " (%s) - press r to reconnect" % statusTimeLabel)
diff --git a/src/util/torTools.py b/src/util/torTools.py
index 9fc396b..1576ede 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -161,16 +161,6 @@ class Controller:
     self.connLock.release()
     return result
   
-  def getHeartbeat(self):
-    """
-    Provides the time of the last registered tor message.
-    """
-    
-    if self.isAlive():
-      return self.controller.get_latest_heartbeat()
-    else:
-      return 0
-  
   def getInfo(self, param, default = UNDEFINED):
     """
     Queries the control port for the given GETINFO option, providing the





More information about the tor-commits mailing list