]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Fix an error in the actions that allowed for the result to be sent twice.
authorCameron Dale <camrdale@gmail.com>
Mon, 21 Apr 2008 18:54:05 +0000 (11:54 -0700)
committerCameron Dale <camrdale@gmail.com>
Mon, 21 Apr 2008 18:54:05 +0000 (11:54 -0700)
apt_p2p_Khashmir/actions.py

index 95aef72aaa9a1055fe1bc74664f50aa27ce589b6..fd5e1c1ade8d2122cfe6f6de0bcbae66e027a8c0 100644 (file)
@@ -117,6 +117,9 @@ class ActionBase:
     
     def schedule(self):
         """Schedule requests to be sent to remote nodes."""
+        if self.finished:
+            return
+        
         # Check if we are already done
         if self.desired_results and ((len(self.results) >= abs(self.desired_results)) or
                                      (self.desired_results < 0 and
@@ -124,9 +127,11 @@ class ActionBase:
             self.finished = True
             result = self.generateResult()
             reactor.callLater(0, self.callback, *result)
+            return
 
-        if self.finished or (self.desired_results and 
-                             len(self.results) + self.outstanding_results >= abs(self.desired_results)):
+        # Check if we have enough outstanding results coming
+        if (self.desired_results and 
+            len(self.results) + self.outstanding_results >= abs(self.desired_results)):
             return
         
         # Loop for each node that should be processed