[or-cvs] r17928: {torctl} Add global succeeded counter. (torctl/trunk/python/TorCtl)

mikeperry at seul.org mikeperry at seul.org
Mon Jan 5 22:41:12 UTC 2009


Author: mikeperry
Date: 2009-01-05 17:41:12 -0500 (Mon, 05 Jan 2009)
New Revision: 17928

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

Add global succeeded counter.



Modified: torctl/trunk/python/TorCtl/StatsSupport.py
===================================================================
--- torctl/trunk/python/TorCtl/StatsSupport.py	2009-01-05 22:33:00 UTC (rev 17927)
+++ torctl/trunk/python/TorCtl/StatsSupport.py	2009-01-05 22:41:12 UTC (rev 17928)
@@ -343,6 +343,7 @@
     self.strm_count = 0
     self.strm_failed = 0
     self.circ_failed = 0
+    self.circ_succeeded = 0
     self.failed_reasons = {}
     self.suspect_reasons = {}
 
@@ -490,6 +491,7 @@
     self.circ_count = 0
     self.strm_count = 0
     self.strm_failed = 0
+    self.circ_succeeded = 0
     self.circ_failed = 0
     self.suspect_reasons.clear()
     self.failed_reasons.clear()
@@ -497,6 +499,9 @@
 
   def close_circuit(self, id):
     PathSupport.PathBuilder.close_circuit(self, id)
+    # Shortcut so we don't have to wait for the CLOSE
+    # events for stats update.
+    self.circ_succeeded += 1
     for r in self.circuits[id].path:
       r.circ_chosen += 1
       r.circ_succeeded += 1
@@ -554,6 +559,7 @@
         # we only get this for a clean close that was not
         # requested by us
         if not self.circuits[c.circ_id].requested_closed:
+          self.circ_succeeded += 1
           for r in self.circuits[c.circ_id].path:
             r.circ_chosen += 1
             if lreason in ("REQUESTED", "FINISHED", "ORIGIN"):



More information about the tor-commits mailing list