Don't crash download thread if no connections
This commit is contained in:
parent
41ead2bfb5
commit
a3398d6a17
|
@ -42,7 +42,10 @@ class DownloadThread(threading.Thread, StoppableThread):
|
|||
# Choose downloading peers randomly
|
||||
connections = BMConnectionPool().inboundConnections.values() + BMConnectionPool().outboundConnections.values()
|
||||
random.shuffle(connections)
|
||||
try:
|
||||
requestChunk = max(int(DownloadThread.maxRequestChunk / len(connections)), 1)
|
||||
except ZeroDivisionError:
|
||||
requestChunk = 1
|
||||
for i in connections:
|
||||
now = time.time()
|
||||
timedOut = now - DownloadThread.requestTimeout
|
||||
|
|
Loading…
Reference in New Issue
Block a user