forked from LBRYCommunity/lbry-sdk
fix join_dht attribute error
This commit is contained in:
parent
d086fb9547
commit
a1aadb0bce
2 changed files with 1 additions and 20 deletions
|
@ -287,7 +287,6 @@ class Session(object):
|
|||
log.info("Starting DHT")
|
||||
|
||||
def start_dht(join_network_result):
|
||||
self.peer_finder.run_manage_loop()
|
||||
self.hash_announcer.run_manage_loop()
|
||||
return True
|
||||
|
||||
|
|
|
@ -22,27 +22,9 @@ class DHTPeerFinder(object):
|
|||
self.dht_node = dht_node
|
||||
self.peer_manager = peer_manager
|
||||
self.peers = []
|
||||
self.next_manage_call = None
|
||||
|
||||
def run_manage_loop(self):
|
||||
self._manage_peers()
|
||||
self.next_manage_call = reactor.callLater(60, self.run_manage_loop)
|
||||
|
||||
def stop(self):
|
||||
log.info("Stopping DHT peer finder.")
|
||||
if self.next_manage_call is not None and self.next_manage_call.active():
|
||||
self.next_manage_call.cancel()
|
||||
self.next_manage_call = None
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _manage_peers(self):
|
||||
"""
|
||||
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()
|
||||
pass
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def find_peers_for_blob(self, blob_hash, timeout=None, filter_self=False):
|
||||
|
|
Loading…
Reference in a new issue