Exemple #1
0
 def _process_outgoing(self):
     if len(self.sending_queue) == 0:
         self.sending_worker = None
         return
     data, rpcID, address = self.sending_queue.pop(0)
     KademliaProtocol._send(self, data, rpcID, address)
     self.sending_worker = reactor.callLater(SENDING_FREQUENCY_SEC, self._process_outgoing)
Exemple #2
0
 def __init__(self, node, msgEncoder=encoding.Bencode(), msgTranslator=msgformat.DefaultFormat()):
     KademliaProtocol.__init__(self, node, msgEncoder, msgTranslator)
     self.receiving_queue = []
     self.receiving_worker = None
     self.sending_queue = []
     self.sending_worker = None
     self._counter = count
Exemple #3
0
 def _process_incoming(self):
     if len(self.receiving_queue) == 0:
         self.receiving_worker = None
         return
     datagram, address = self.receiving_queue.pop(0)
     KademliaProtocol.datagramReceived(self, datagram, address)
     self.receiving_worker = reactor.callLater(RECEIVING_FREQUENCY_SEC, self._process_incoming)
Exemple #4
0
 def _process_outgoing(self):
     if len(self.sending_queue) == 0:
         self.sending_worker = None
         return
     data, rpcID, address = self.sending_queue.pop(0)
     KademliaProtocol._send(self, data, rpcID, address)
     t = 0
     if len(self.sending_queue) > SENDING_QUEUE_LENGTH_CRITICAL:
         t = SENDING_FREQUENCY_SEC
     self.sending_worker = reactor.callLater(t, self._process_outgoing)  #@UndefinedVariable
Exemple #5
0
 def _process_incoming(self):
     if len(self.receiving_queue) == 0:
         self.receiving_worker = None
         return
     datagram, address = self.receiving_queue.pop(0)
     KademliaProtocol.datagramReceived(self, datagram, address)
     t = 0
     if len(self.receiving_queue) > RECEIVING_QUEUE_LENGTH_CRITICAL / 2:
         t = RECEIVING_FREQUENCY_SEC
     self.receiving_worker = reactor.callLater(t, self._process_incoming)  #@UndefinedVariable