Revert "remove deferral.sleep's canceller, as it wasn't used anywhere and caused...
authorForrest Voight <forrest@forre.st>
Fri, 2 Aug 2013 18:36:37 +0000 (14:36 -0400)
committerForrest Voight <forrest@forre.st>
Sat, 3 Aug 2013 22:57:07 +0000 (18:57 -0400)
This reverts commit b3a4925e7eb1e99ce6e304fc10b60dfc16fb5ee7.

p2pool/util/deferral.py

index 0601d39..aed3adc 100644 (file)
@@ -8,8 +8,8 @@ from twisted.internet import defer, reactor
 from twisted.python import failure, log
 
 def sleep(t):
-    d = defer.Deferred()
-    reactor.callLater(t, d.callback, None)
+    d = defer.Deferred(canceller=lambda d_: dc.cancel())
+    dc = reactor.callLater(t, d.callback, None)
     return d
 
 def run_repeatedly(f, *args, **kwargs):