Download fixes
- don't expire too quickly - ignore connections that haven't been fully established yet
This commit is contained in:
parent
c5dc7fc903
commit
290b87a49f
|
@ -38,7 +38,7 @@ class DownloadThread(threading.Thread, StoppableThread):
|
|||
while not self._stopped:
|
||||
requested = 0
|
||||
# Choose downloading peers randomly
|
||||
connections = BMConnectionPool().inboundConnections.values() + BMConnectionPool().outboundConnections.values()
|
||||
connections = [x for x in BMConnectionPool().inboundConnections.values() + BMConnectionPool().outboundConnections.values() if x.fullyEstablished]
|
||||
random.shuffle(connections)
|
||||
try:
|
||||
requestChunk = max(int(min(DownloadThread.maxRequestChunk, len(missingObjects)) / len(connections)), 1)
|
||||
|
@ -46,7 +46,6 @@ class DownloadThread(threading.Thread, StoppableThread):
|
|||
requestChunk = 1
|
||||
for i in connections:
|
||||
now = time.time()
|
||||
timedOut = now - DownloadThread.requestTimeout
|
||||
try:
|
||||
request = i.objectsNewToMe.randomKeys(requestChunk)
|
||||
except KeyError:
|
||||
|
|
|
@ -85,7 +85,7 @@ class ObjectTracker(object):
|
|||
if hashId in Dandelion().hashMap:
|
||||
Dandelion().fluffTrigger(hashId)
|
||||
if hashId not in missingObjects:
|
||||
missingObjects[hashId] = True
|
||||
missingObjects[hashId] = time.time()
|
||||
self.objectsNewToMe[hashId] = True
|
||||
|
||||
def hasAddr(self, addr):
|
||||
|
|
Reference in New Issue
Block a user