From 290b87a49f9f64714862522227af04cf4b76bbb3 Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Thu, 1 Feb 2018 12:48:14 +0100 Subject: [PATCH] Download fixes - don't expire too quickly - ignore connections that haven't been fully established yet --- src/network/downloadthread.py | 3 +-- src/network/objectracker.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/network/downloadthread.py b/src/network/downloadthread.py index d81b06e8..f3beb77c 100644 --- a/src/network/downloadthread.py +++ b/src/network/downloadthread.py @@ -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: diff --git a/src/network/objectracker.py b/src/network/objectracker.py index 044d11a2..327304d9 100644 --- a/src/network/objectracker.py +++ b/src/network/objectracker.py @@ -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):