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:
|
while not self._stopped:
|
||||||
requested = 0
|
requested = 0
|
||||||
# Choose downloading peers randomly
|
# 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)
|
random.shuffle(connections)
|
||||||
try:
|
try:
|
||||||
requestChunk = max(int(min(DownloadThread.maxRequestChunk, len(missingObjects)) / len(connections)), 1)
|
requestChunk = max(int(min(DownloadThread.maxRequestChunk, len(missingObjects)) / len(connections)), 1)
|
||||||
|
@ -46,7 +46,6 @@ class DownloadThread(threading.Thread, StoppableThread):
|
||||||
requestChunk = 1
|
requestChunk = 1
|
||||||
for i in connections:
|
for i in connections:
|
||||||
now = time.time()
|
now = time.time()
|
||||||
timedOut = now - DownloadThread.requestTimeout
|
|
||||||
try:
|
try:
|
||||||
request = i.objectsNewToMe.randomKeys(requestChunk)
|
request = i.objectsNewToMe.randomKeys(requestChunk)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
|
@ -85,7 +85,7 @@ class ObjectTracker(object):
|
||||||
if hashId in Dandelion().hashMap:
|
if hashId in Dandelion().hashMap:
|
||||||
Dandelion().fluffTrigger(hashId)
|
Dandelion().fluffTrigger(hashId)
|
||||||
if hashId not in missingObjects:
|
if hashId not in missingObjects:
|
||||||
missingObjects[hashId] = True
|
missingObjects[hashId] = time.time()
|
||||||
self.objectsNewToMe[hashId] = True
|
self.objectsNewToMe[hashId] = True
|
||||||
|
|
||||||
def hasAddr(self, addr):
|
def hasAddr(self, addr):
|
||||||
|
|
Reference in New Issue
Block a user