Merge branch 'fix-join-dht-attribute-error'
This commit is contained in:
commit
476a44ddb5
2 changed files with 1 additions and 20 deletions
|
@ -287,7 +287,6 @@ class Session(object):
|
||||||
log.info("Starting DHT")
|
log.info("Starting DHT")
|
||||||
|
|
||||||
def start_dht(join_network_result):
|
def start_dht(join_network_result):
|
||||||
self.peer_finder.run_manage_loop()
|
|
||||||
self.hash_announcer.run_manage_loop()
|
self.hash_announcer.run_manage_loop()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -22,27 +22,9 @@ class DHTPeerFinder(object):
|
||||||
self.dht_node = dht_node
|
self.dht_node = dht_node
|
||||||
self.peer_manager = peer_manager
|
self.peer_manager = peer_manager
|
||||||
self.peers = []
|
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):
|
def stop(self):
|
||||||
log.info("Stopping DHT peer finder.")
|
pass
|
||||||
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()
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def find_peers_for_blob(self, blob_hash, timeout=None, filter_self=False):
|
def find_peers_for_blob(self, blob_hash, timeout=None, filter_self=False):
|
||||||
|
|
Loading…
Reference in a new issue