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

[tor-commits] [ooni-probe/master] modify resetTimer and cancelTimer to avoid alreadyCancelled exception



commit 2a385f9292755fe66fea4f6952c02c033ff715c6
Author: juga0 <juga>
Date:   Sat Sep 19 19:24:10 2015 +0000

    modify resetTimer and cancelTimer to avoid alreadyCancelled exception
---
 ooni/templates/process.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ooni/templates/process.py b/ooni/templates/process.py
index 3bbd8f6..4939441 100644
--- a/ooni/templates/process.py
+++ b/ooni/templates/process.py
@@ -19,6 +19,7 @@ class ProcessDirector(protocol.ProcessProtocol):
     def cancelTimer(self):
         if self.timeout and self.timer:
             self.timer.cancel()
+            self.timer = None
 
     def close(self, reason=None):
         self.reason = reason
@@ -26,7 +27,7 @@ class ProcessDirector(protocol.ProcessProtocol):
 
     def resetTimer(self):
         if self.timeout is not None:
-            if self.timer is not None:
+            if self.timer is not None and self.timer.active():
                 self.timer.cancel()
             self.timer = reactor.callLater(self.timeout,
                                            self.close,



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