DHTPeerFinder: re-join the network if we have no peers

Periodically check if the routing table is empty and, if so,
re-attempt joining the DHT network.

This check is performed in the main DHTPeerFinder loop every 60 secs.

Closes: #1093
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
This commit is contained in:
Antonio Quartulli 2018-02-01 17:22:39 +08:00
parent 4f7885e499
commit 8a7e707504
No known key found for this signature in database
GPG key ID: 07A53C580EF2CD74
2 changed files with 9 additions and 1 deletions

View file

@ -40,6 +40,7 @@ at anytime.
* Remove manual saving of the wallet in from lbrynet, let lbryum handle it
* Block wallet startup on being unlocked if it is encrypted
* Use reworked lbryum payto command
* Re-attempt joining the DHT every 60 secs if the Node has no peers
### Added
* Add link to instructions on how to change the default peer port

View file

@ -34,8 +34,15 @@ class DHTPeerFinder(object):
self.next_manage_call.cancel()
self.next_manage_call = None
@defer.inlineCallbacks
def _manage_peers(self):
pass
"""
If we don't know any active peer, let's try to reconnect to the preconfigured
known DHT nodes
"""
if not self.dht_node.hasContacts():
log.info("No active peer. Re-attempt joining DHT")
yield self.dht_node.join_dht()
@defer.inlineCallbacks
def find_peers_for_blob(self, blob_hash, timeout=None, filter_self=False):