Exemplo n.º 1
0
def _findNewNodes( nodeTable, dhtClient, reactor, callback=None ) :
    destId = numToId( randint(0,DHT_ID_MAX-1) )
    startNodes = nodeTable.getLiveNodes()
    def onLookup( nodes ) :
        op.notify()
    lookupOp = dhtClient.lookup( destId, startNodes, onLookup )
    op = AsyncOp( callback, lookupOp.cancel )
    return op
Exemplo n.º 2
0
 def doRefresh() :
     bucket = choice( self.ktable.table )
     destNumId = randint( bucket.start, bucket.end-1 )
     destId = numToId( destNumId )
     startNodes = self.ktable.getClosestNodes( destNumId )
     if not startNodes :
         doWait()
         return
     obj.op = self.client.lookup( destId, startNodes, onLookup )
Exemplo n.º 3
0
Arquivo: node.py Projeto: hj91/cspace
 def doRefresh():
     bucket = choice(self.ktable.table)
     destNumId = randint(bucket.start, bucket.end - 1)
     destId = numToId(destNumId)
     startNodes = self.ktable.getClosestNodes(destNumId)
     if not startNodes:
         doWait()
         return
     obj.op = self.client.lookup(destId, startNodes, onLookup)
Exemplo n.º 4
0
def _findNewNodes(nodeTable, dhtClient, reactor, callback=None):
    destId = numToId(randint(0, DHT_ID_MAX - 1))
    startNodes = nodeTable.getLiveNodes()

    def onLookup(nodes):
        op.notify()

    lookupOp = dhtClient.lookup(destId, startNodes, onLookup)
    op = AsyncOp(callback, lookupOp.cancel)
    return op
Exemplo n.º 5
0
 def _onLookupTimer( self ) :
     destId = numToId( randint(0,DHT_ID_MAX-1) )
     startNodes = self.nodeTable.getLiveNodes()
     self.lookupOp = self.dhtClient.lookup( destId, startNodes,
             self._onLookup )
Exemplo n.º 6
0
 def _onLookupTimer(self):
     destId = numToId(randint(0, DHT_ID_MAX - 1))
     startNodes = self.nodeTable.getLiveNodes()
     self.lookupOp = self.dhtClient.lookup(destId, startNodes,
                                           self._onLookup)