[or-cvs] r18125: {torctl} Keep an extra refcount on StatsRouters so we can track uptim (torctl/trunk/python/TorCtl)

mikeperry at seul.org mikeperry at seul.org
Fri Jan 16 02:41:13 UTC 2009


Author: mikeperry
Date: 2009-01-15 21:41:13 -0500 (Thu, 15 Jan 2009)
New Revision: 18125

Modified:
   torctl/trunk/python/TorCtl/StatsSupport.py
Log:

Keep an extra refcount on StatsRouters so we can track uptime for them.



Modified: torctl/trunk/python/TorCtl/StatsSupport.py
===================================================================
--- torctl/trunk/python/TorCtl/StatsSupport.py	2009-01-16 02:40:21 UTC (rev 18124)
+++ torctl/trunk/python/TorCtl/StatsSupport.py	2009-01-16 02:41:13 UTC (rev 18125)
@@ -192,6 +192,9 @@
     # TODO: Use __metaclass__ and type to do this instead?
     self.__dict__ = router.__dict__
     self.reset()
+    # StatsRouters should not be destroyed when Tor forgets about them
+    # Give them an extra refcount:
+    self.refcount += 1 
   
   def reset(self):
     "Reset all stats on this Router"
@@ -672,6 +675,7 @@
     PathBuilder.stream_status_event(self, s)
 
   def ns_event(self, n):
+    # XXX: Non-Running routers are stripped here..
     PathBuilder.ns_event(self, n)
     now = n.arrived_at
     for ns in n.nslist:



More information about the tor-commits mailing list