if self.outstanding == 0:
## all done!!
self.finished=1
- reactor.callFromThread(self.callback, l[:K])
+ reactor.callLater(0, self.callback, l[:K])
def makeMsgFailed(self, node):
def defaultGotNodes(err, self=self, node=node):
z = len(dict['values'])
v = filter(None, map(x, dict['values']))
if(len(v)):
- reactor.callFromThread(self.callback, v)
+ reactor.callLater(0, self.callback, v)
self.schedule()
## get value
if self.outstanding == 0:
## all done, didn't find it!!
self.finished=1
- reactor.callFromThread(self.callback,[])
+ reactor.callLater(0, self.callback,[])
## get value
def goWithNodes(self, nodes, found=None):
from twisted.internet.defer import Deferred
from twisted.internet import protocol
-from twisted.python import threadable
from twisted.application import service, internet
from twisted.web import server
-threadable.init()
import sys
from random import randrange
else:
# create our search state
state = FindNode(self, id, d.callback)
- reactor.callFromThread(state.goWithNodes, nodes)
+ reactor.callLater(0, state.goWithNodes, nodes)
def insertNode(self, n, contacted=1):
"""
# create our search state
state = GetValue(self, key, callback)
- reactor.callFromThread(state.goWithNodes, nodes, l)
+ reactor.callLater(0, state.goWithNodes, nodes, l)
def krpc_find_value(self, key, id, _krpc_sender):
sender = {'id' : id}
pass
response=_storedValueHandler
action = StoreValue(self.table, key, value, response)
- reactor.callFromThread(action.goWithNodes, nodes)
+ reactor.callLater(action.goWithNodes, nodes)
# this call is asynch
self.findNode(key, _storeValueForKey)