]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Disconnect the insertNode calls from the callers so errors don't affect them.
authorCameron Dale <camrdale@gmail.com>
Wed, 23 Apr 2008 02:10:21 +0000 (19:10 -0700)
committerCameron Dale <camrdale@gmail.com>
Wed, 23 Apr 2008 02:10:21 +0000 (19:10 -0700)
apt_p2p_Khashmir/actions.py
apt_p2p_Khashmir/khashmir.py

index 0ac96479a9e716c5dd6801c9f9e8014ba9239610..bd1cd2f6f1905672717b1b90e0358040afbdf8e9 100644 (file)
@@ -186,7 +186,7 @@ class ActionBase:
 
     def gotResponse(self, dict, node, expected_results, df):
         """Receive a response from a remote node."""
-        self.caller.insertNode(node)
+        reactor.callLater(0, self.caller.insertNode, node)
         if self.finished or self.answered.has_key(node.id):
             # a day late and a dollar short
             return
index 15237a2338c141b5a0a6b46992a0fdbddb87bc75..5db5ed8ab48015c9c73073f9c8ceab8eac652701 100644 (file)
@@ -233,7 +233,7 @@ class KhashmirBase(protocol.Factory):
             """Node responded properly, callback with response."""
             n = self.Node(dict['id'], dict['_krpc_sender'][0], dict['_krpc_sender'][1])
             self.stats.completedAction('join', start)
-            self.insertNode(n)
+            reactor.callLater(0, self.insertNode, n)
             if callback:
                 callback((dict['ip_addr'], dict['port']))
 
@@ -306,7 +306,7 @@ class KhashmirBase(protocol.Factory):
         """
         if _krpc_sender is not None:
             n = self.Node(id, _krpc_sender[0], _krpc_sender[1])
-            self.insertNode(n, contacted = False)
+            reactor.callLater(0, self.insertNode, n, False)
 
         return {"id" : self.node.id}
         
@@ -320,7 +320,7 @@ class KhashmirBase(protocol.Factory):
         """
         if _krpc_sender is not None:
             n = self.Node(id, _krpc_sender[0], _krpc_sender[1])
-            self.insertNode(n, contacted = False)
+            reactor.callLater(0, self.insertNode, n, False)
         else:
             _krpc_sender = ('127.0.0.1', self.port)
 
@@ -338,7 +338,7 @@ class KhashmirBase(protocol.Factory):
         """
         if _krpc_sender is not None:
             n = self.Node(id, _krpc_sender[0], _krpc_sender[1])
-            self.insertNode(n, contacted = False)
+            reactor.callLater(0, self.insertNode, n, False)
         else:
             _krpc_sender = ('127.0.0.1', self.port)
 
@@ -414,7 +414,7 @@ class KhashmirRead(KhashmirBase):
         """
         if _krpc_sender is not None:
             n = self.Node(id, _krpc_sender[0], _krpc_sender[1])
-            self.insertNode(n, contacted = False)
+            reactor.callLater(0, self.insertNode, n, False)
     
         nodes = self.table.findNodes(key)
         nodes = map(lambda node: node.contactInfo(), nodes)
@@ -436,7 +436,7 @@ class KhashmirRead(KhashmirBase):
         """
         if _krpc_sender is not None:
             n = self.Node(id, _krpc_sender[0], _krpc_sender[1])
-            self.insertNode(n, contacted = False)
+            reactor.callLater(0, self.insertNode, n, False)
     
         l = self.store.retrieveValues(key)
         if num == 0 or num >= len(l):
@@ -496,7 +496,7 @@ class KhashmirWrite(KhashmirRead):
         """
         if _krpc_sender is not None:
             n = self.Node(id, _krpc_sender[0], _krpc_sender[1])
-            self.insertNode(n, contacted = False)
+            reactor.callLater(0, self.insertNode, n, False)
         else:
             _krpc_sender = ('127.0.0.1', self.port)