From 8115337306f4d45abaf92719f05adab4d011851a Mon Sep 17 00:00:00 2001 From: Cameron Dale Date: Sat, 21 Jun 2008 23:55:36 -0700 Subject: [PATCH] Make sure bad nodes don't get added to the routing table. --- apt_p2p_Khashmir/actions.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apt_p2p_Khashmir/actions.py b/apt_p2p_Khashmir/actions.py index 8542706..883bccb 100644 --- a/apt_p2p_Khashmir/actions.py +++ b/apt_p2p_Khashmir/actions.py @@ -191,21 +191,22 @@ class ActionBase: def gotResponse(self, dict, node): """Receive a response from a remote node.""" - if node.id != self.caller.node.id: - reactor.callLater(0, self.caller.insertNode, node) - if self.finished or self.answered.has_key(node.id): + if self.finished or self.answered.has_key(node.id) or self.failed.has_key(node.id): # a day late and a dollar short return try: # Process the response self.processResponse(dict) - self.answered[node.id] = 1 except Exception, e: # Unexpected error with the response log.msg("action %s failed on %s/%s: %r" % (self.action, node.host, node.port, e)) if node.id != self.caller.node.id: self.caller.nodeFailed(node) self.failed[node.id] = 1 + else: + self.answered[node.id] = 1 + if node.id != self.caller.node.id: + reactor.callLater(0, self.caller.insertNode, node) if self.outstanding.has_key(node.id): self.outstanding_results -= self.outstanding[node.id] del self.outstanding[node.id] -- 2.30.2