From b2de61b864a5ee74afc9b6eafb4a64ff31ba1ba0 Mon Sep 17 00:00:00 2001 From: burris Date: Sat, 14 Sep 2002 00:19:10 +0000 Subject: [PATCH] fixed nonresponsive node handler --- actions.py | 5 ++++- khashmir.py | 4 ++-- xmlrpcclient.py | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/actions.py b/actions.py index 77160d7..0a6062f 100644 --- a/actions.py +++ b/actions.py @@ -173,7 +173,8 @@ class GetValue(FindNode): self.found[node.id] = node #xxx t.timeout = time.time() + FIND_NODE_TIMEOUT df = node.findValue(self.target, self.table.node.senderDict()) - df.addCallbacks(self.handleGotNodes, self.defaultGotNodes) + df.addCallback(self.handleGotNodes) + df.addErrback(self.defaultGotNodes) self.outstanding = self.outstanding + 1 self.queried[node.id] = 1 if self.outstanding == 0: @@ -226,6 +227,8 @@ class KeyExpirer: self.store.delete(h) ic.delete() i = i + 1 + else: + break irec = f() reactor.callLater(KE_DELAY, self.doExpire) diff --git a/khashmir.py b/khashmir.py index 509725b..8ef6221 100644 --- a/khashmir.py +++ b/khashmir.py @@ -209,7 +209,6 @@ class Khashmir(xmlrpc.XMLRPC): v = loads(self.store[h1])[1] l.append(v) tup = c.next() - l = map(lambda v: Binary(v), l) return l return [] @@ -265,7 +264,8 @@ class Khashmir(xmlrpc.XMLRPC): self.insertNode(n) l = self.retrieveValues(key) - if len(l): + if len(l) > 0: + l = map(lambda v: Binary(v), l) return {'values' : l}, self.node.senderDict() else: nodes = self.table.findNodes(key) diff --git a/xmlrpcclient.py b/xmlrpcclient.py index 5c8f3cf..8e4cc69 100644 --- a/xmlrpcclient.py +++ b/xmlrpcclient.py @@ -41,3 +41,6 @@ class XMLRPCClientFactory(ClientFactory): prot.args = self.args prot.d = self.d return prot + + def clientConnectionFailed(self, connector, reason): + self.d.errback() \ No newline at end of file -- 2.39.5