set the peer search timeout as configured and raise it to 30s
This commit is contained in:
parent
7e0784d8e0
commit
1cc7ce69ab
2 changed files with 5 additions and 2 deletions
|
@ -291,7 +291,7 @@ ADJUSTABLE_SETTINGS = {
|
||||||
'run_reflector_server': (bool, False),
|
'run_reflector_server': (bool, False),
|
||||||
'sd_download_timeout': (int, 3),
|
'sd_download_timeout': (int, 3),
|
||||||
'share_usage_data': (bool, True), # whether to share usage stats and diagnostic info with LBRY
|
'share_usage_data': (bool, True), # whether to share usage stats and diagnostic info with LBRY
|
||||||
'peer_search_timeout': (int, 3),
|
'peer_search_timeout': (int, 30),
|
||||||
'use_auth_http': (bool, False),
|
'use_auth_http': (bool, False),
|
||||||
'use_upnp': (bool, True),
|
'use_upnp': (bool, True),
|
||||||
'use_keyring': (bool, False),
|
'use_keyring': (bool, False),
|
||||||
|
|
|
@ -4,6 +4,7 @@ import logging
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from lbrynet.interfaces import IPeerFinder
|
from lbrynet.interfaces import IPeerFinder
|
||||||
|
from lbrynet import conf
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -43,12 +44,14 @@ class DHTPeerFinder(DummyPeerFinder):
|
||||||
"""
|
"""
|
||||||
bin_hash = binascii.unhexlify(blob_hash)
|
bin_hash = binascii.unhexlify(blob_hash)
|
||||||
finished_deferred = self.dht_node.iterativeFindValue(bin_hash)
|
finished_deferred = self.dht_node.iterativeFindValue(bin_hash)
|
||||||
|
timeout = timeout or conf.settings['peer_search_timeout']
|
||||||
if timeout:
|
if timeout:
|
||||||
finished_deferred.addTimeout(timeout, self.dht_node.clock)
|
finished_deferred.addTimeout(timeout, self.dht_node.clock)
|
||||||
try:
|
try:
|
||||||
peer_list = yield finished_deferred
|
peer_list = yield finished_deferred
|
||||||
except defer.TimeoutError:
|
except defer.TimeoutError:
|
||||||
log.warning("DHT timed out while looking peers for blob {}".format(blob_hash))
|
log.warning("DHT timed out while looking peers for blob"
|
||||||
|
" %s after %s seconds.", blob_hash, timeout)
|
||||||
peer_list = []
|
peer_list = []
|
||||||
|
|
||||||
peers = set(peer_list)
|
peers = set(peer_list)
|
||||||
|
|
Loading…
Reference in a new issue