[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [arm/release] fix: GUARD event support



commit ce2ff76cc352309ac4450d6dc9f94e1db7da4983
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Wed Aug 3 09:01:48 2011 -0700

    fix: GUARD event support
    
    The log panel wasn't receiving GUARD events, causing them to be silently
    dropped. Also doing better parsing for timestamp entries.
---
 src/cli/logPanel.py |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/cli/logPanel.py b/src/cli/logPanel.py
index bb47517..f39617d 100644
--- a/src/cli/logPanel.py
+++ b/src/cli/logPanel.py
@@ -533,7 +533,18 @@ class TorEventObserver(TorCtl.PostEventListener):
     self._notify(event, ", ".join(idlistStr))
   
   def address_mapped_event(self, event):
-    self._notify(event, "%s, %s -> %s" % (event.when, event.from_addr, event.to_addr))
+    whenLabel, gmtExpiryLabel = "", ""
+    
+    if event.when:
+      whenLabel = time.strftime("%H:%M %m/%d/%Y", event.when)
+    
+    # TODO: torctl is getting an 'error' and 'gmt_expiry' attribute so display
+    # those when they become available
+    #
+    #if event.gmt_expiry:
+    #  gmtExpiryLabel = time.strftime("%H:%M %m/%d/%Y", event.gmt_expiry)
+    
+    self._notify(event, "%s, %s -> %s" % (whenLabel, event.from_addr, event.to_addr))
   
   def ns_event(self, event):
     # NetworkStatus params: nickname, idhash, orhash, ip, orport (int),
@@ -545,6 +556,10 @@ class TorEventObserver(TorCtl.PostEventListener):
     msg = ", ".join(["%s (%s)" % (ns.idhex, ns.nickname) for ns in event.nslist])
     self._notify(event, "Listed (%i): %s" % (len(event.nslist), msg), "magenta")
   
+  def guard_event(self, event):
+    msg = "%s (%s), STATUS: %s" % (event.idhex, event.nick, event.status)
+    self._notify(event, msg, "yellow")
+  
   def unknown_event(self, event):
     msg = "(%s) %s" % (event.event_name, event.event_string)
     self.callback(LogEntry(event.arrived_at, "UNKNOWN", msg, "red"))



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits