Don't freeze when out of known nodes
- bitmessage could end up having no known nodes and then it would freeze. Now it shouldn't freeze, however it can still end up without known nodes until a restart in some cases (e.g. when suspending the computer for more then 3 days while BM is running)
This commit is contained in:
parent
306a2495e0
commit
4117195b61
|
@ -37,7 +37,12 @@ class outgoingSynSender(threading.Thread, StoppableThread):
|
||||||
else:
|
else:
|
||||||
while not shared.shutdown:
|
while not shared.shutdown:
|
||||||
shared.knownNodesLock.acquire()
|
shared.knownNodesLock.acquire()
|
||||||
|
try:
|
||||||
peer, = random.sample(shared.knownNodes[self.streamNumber], 1)
|
peer, = random.sample(shared.knownNodes[self.streamNumber], 1)
|
||||||
|
except ValueError: # no known nodes
|
||||||
|
shared.knownNodesLock.release()
|
||||||
|
time.sleep(1)
|
||||||
|
continue
|
||||||
priority = (183600 - (time.time() - shared.knownNodes[self.streamNumber][peer])) / 183600 # 2 days and 3 hours
|
priority = (183600 - (time.time() - shared.knownNodes[self.streamNumber][peer])) / 183600 # 2 days and 3 hours
|
||||||
shared.knownNodesLock.release()
|
shared.knownNodesLock.release()
|
||||||
if shared.config.get('bitmessagesettings', 'socksproxytype') != 'none':
|
if shared.config.get('bitmessagesettings', 'socksproxytype') != 'none':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user