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

[tor-commits] [pytorctl/master] added reset_stats() to Scansupport.py



commit 13307d9cc0ed54bf5602c2c9b5e8db86113f3a45
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Mon Apr 18 10:38:50 2011 -0700

    added reset_stats() to Scansupport.py
    
    calls parent and SQLSupport reset functions
    Tests show that SQLSupport.reset_all() may clear too much because
    if BwAuthority calls Scansupport.reset_stats() after each speedrace()
    run only the first slice is properly recorded; the rest are empty.
    See: https://trac.torproject.org/projects/tor/ticket/2947
---
 ScanSupport.py |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/ScanSupport.py b/ScanSupport.py
index f2a39d9..c425fd2 100644
--- a/ScanSupport.py
+++ b/ScanSupport.py
@@ -260,4 +260,15 @@ class SQLScanHandler(ScanHandler):
     cond.release()
     plog("INFO", "Consensus OK")
 
-
+  def reset_stats(self):
+    cond = threading.Condition()
+    def notlambda(this):
+      cond.acquire()
+      ScanHandler.reset_stats(self)
+      SQLSupport.reset_all()
+      cond.notify()
+      cond.release()
+    cond.acquire()
+    self.schedule_low_prio(notlambda)
+    cond.wait()
+    cond.release()



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