diff --git a/lbrynet/dht/node.py b/lbrynet/dht/node.py index 5aeb493c3..4286e69ac 100644 --- a/lbrynet/dht/node.py +++ b/lbrynet/dht/node.py @@ -650,14 +650,19 @@ class Node(MockKademliaHelper): def _refreshNode(self): """ Periodically called to perform k-bucket refreshes and data replication/republishing as necessary """ - yield self._refreshRoutingTable() self._dataStore.removeExpiredPeers() defer.returnValue(None) + def _refreshContacts(self): + return defer.DeferredList( + [self._protocol._ping_queue.enqueue_maybe_ping(contact) for contact in self.contacts] + ) + @defer.inlineCallbacks def _refreshRoutingTable(self): nodeIDs = self._routingTable.getRefreshList(0, True) + yield self._refreshContacts() while nodeIDs: searchID = nodeIDs.pop() yield self.iterativeFindNode(searchID) diff --git a/lbrynet/dht/protocol.py b/lbrynet/dht/protocol.py index 0ab200b13..49325770c 100644 --- a/lbrynet/dht/protocol.py +++ b/lbrynet/dht/protocol.py @@ -85,6 +85,7 @@ class PingQueue(object): def enqueue_maybe_ping(self, contact): return self._semaphore.run(self._add_contact, contact) + class KademliaProtocol(protocol.DatagramProtocol): """ Implements all low-level network-related functions of a Kademlia node """