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

[tor-commits] [torbel/master] Fix problem with reactor and LoopingCall.



commit e668dd1997b902ffc19c165d1400a98ee2e62938
Author: Harry Bock <hbock@xxxxxxxxxxx>
Date:   Tue Sep 7 17:09:31 2010 -0400

    Fix problem with reactor and LoopingCall.
    
    Reactor would not properly schedule connectTCP calls when
    LoopingCall was used.
    Might only be an issue with older Twisted versions (from Lenny, circa
    8.1.0), but replacing it with callLater seems to work for now.
---
 scheduler.py |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/scheduler.py b/scheduler.py
index dc0d1d4..e246732 100644
--- a/scheduler.py
+++ b/scheduler.py
@@ -52,7 +52,6 @@ class TestScheduler:
         self.max_pending_circuits = int(self.max_running_circuits * max_pending_factor)
 
         self.export_interval = export_interval
-        self.export_task = task.LoopingCall(self.export)
         self.init()
 
     def init(self):
@@ -64,11 +63,12 @@ class TestScheduler:
         """ Start the scheduler. """
         # Start the export looping task, but don't run it immediately -
         # wait until the first export_interval (converted to seconds) to pass.
-        self.export_task.start(self.export_interval * 60, now = False)
+        reactor.callLater(self.export_interval * 60, self.export)
 
     def export(self):
         """ Force the controller to export all test data. """
         self.controller.export()
+        reactor.callLater(self.export_interval * 60, self.export)
                 
     def next(self):
         """ Return a set of routers to be tested. May block until enough routers
@@ -133,9 +133,6 @@ class TestScheduler:
 
     def stop(self):
         """ Stop the scheduler. """
-        # Stop our export task.
-        if self.export_task.running:
-            self.export_task.stop()
         with self.pending_circuit_cond:
             self.pending_circuit_cond.notify()
             self.terminated = True



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