From aa0f99580b06354d1affbef134d5763b534026b6 Mon Sep 17 00:00:00 2001 From: Cameron Dale Date: Mon, 21 Apr 2008 11:54:05 -0700 Subject: [PATCH] Fix an error in the actions that allowed for the result to be sent twice. --- apt_p2p_Khashmir/actions.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apt_p2p_Khashmir/actions.py b/apt_p2p_Khashmir/actions.py index 95aef72..fd5e1c1 100644 --- a/apt_p2p_Khashmir/actions.py +++ b/apt_p2p_Khashmir/actions.py @@ -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 -- 2.39.5