Download fixes
- check if already have object before requesting
This commit is contained in:
parent
dcce7ed4c5
commit
8498143783
|
@ -5,6 +5,7 @@ import time
|
||||||
import addresses
|
import addresses
|
||||||
from debug import logger
|
from debug import logger
|
||||||
from helper_threading import StoppableThread
|
from helper_threading import StoppableThread
|
||||||
|
from inventory import Inventory
|
||||||
from network.connectionpool import BMConnectionPool
|
from network.connectionpool import BMConnectionPool
|
||||||
import protocol
|
import protocol
|
||||||
from state import missingObjects
|
from state import missingObjects
|
||||||
|
@ -53,6 +54,9 @@ class DownloadThread(threading.Thread, StoppableThread):
|
||||||
payload = bytearray()
|
payload = bytearray()
|
||||||
payload.extend(addresses.encodeVarint(len(request)))
|
payload.extend(addresses.encodeVarint(len(request)))
|
||||||
for chunk in request:
|
for chunk in request:
|
||||||
|
if chunk in Inventory():
|
||||||
|
del i.objectsNewToMe[chunk]
|
||||||
|
continue
|
||||||
payload.extend(chunk)
|
payload.extend(chunk)
|
||||||
missingObjects[chunk] = now
|
missingObjects[chunk] = now
|
||||||
i.append_write_buf(protocol.CreatePacket('getdata', payload))
|
i.append_write_buf(protocol.CreatePacket('getdata', payload))
|
||||||
|
|
Reference in New Issue
Block a user