reactor.callLater(10, self._connect_timeout)
self.timeout_delayed = reactor.callLater(100, self._timeout)
+
+ old_dataReceived = self.dataReceived
+ self.dataReceived = lambda data: (self.timeout_delayed.reset(100) if not self.timeout_delayed.called else None, old_dataReceived(data))[0]
def _connect_timeout(self):
if not self.connected2 and self.transport.connected:
self.transport.loseConnection()
return
- if not self.timeout_delayed.called:
- self.timeout_delayed.cancel()
- self.timeout_delayed = reactor.callLater(100, self._timeout)
-
bitcoin_p2p.BaseProtocol.packetReceived(self, command, payload2)
def _timeout(self):