objecttracker flake8 fixes

This commit is contained in:
lakshyacis 2019-09-05 20:09:11 +05:30
parent ef77a9816e
commit 77651eebe3
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB

View File

@ -85,15 +85,15 @@ class ObjectTracker(object):
self.objectsNewToMe[hashId] = True self.objectsNewToMe[hashId] = True
def handleReceivedObject(self, streamNumber, hashid): def handleReceivedObject(self, streamNumber, hashid):
for i in network.connectionpool.BMConnectionPool().inboundConnections.values() + network.connectionpool.BMConnectionPool().outboundConnections.values(): for i in network.connectionpool.BMConnectionPool().inboundConnections.values(
) + network.connectionpool.BMConnectionPool().outboundConnections.values():
if not i.fullyEstablished: if not i.fullyEstablished:
continue continue
try: try:
del i.objectsNewToMe[hashid] del i.objectsNewToMe[hashid]
except KeyError: except KeyError:
if streamNumber in i.streams and \ if streamNumber in i.streams and (
(not Dandelion().hasHash(hashid) or \ not Dandelion().hasHash(hashid) or Dandelion().objectChildStem(hashid) == i):
Dandelion().objectChildStem(hashid) == i):
with i.objectsNewToThemLock: with i.objectsNewToThemLock:
i.objectsNewToThem[hashid] = time.time() i.objectsNewToThem[hashid] = time.time()
# update stream number, which we didn't have when we just received the dinv # update stream number, which we didn't have when we just received the dinv
@ -116,16 +116,18 @@ class ObjectTracker(object):
if haveBloom: if haveBloom:
self.addrBloom.add(hashid) self.addrBloom.add(hashid)
# addr sending -> per node upload queue, and flush every minute or so
# inv sending -> if not in bloom, inv immediately, otherwise put into a per node upload queue and flush every minute or so
# data sending -> a simple queue
# no bloom """
# - if inv arrives addr sending -> per node upload queue, and flush every minute or so
# - if we don't have it, add tracking and download queue inv sending -> if not in bloom, inv immediately, otherwise put into a per node upload queue
# - if we do have it, remove from tracking and flush every minute or so
# tracking downloads data sending -> a simple queue
# - per node hash of items the node has but we don't no bloom
# tracking inv - if inv arrives
# - per node hash of items that neither the remote node nor we have - if we don't have it, add tracking and download queue
# - if we do have it, remove from tracking
tracking downloads
- per node hash of items the node has but we don't
tracking inv
- per node hash of items that neither the remote node nor we have
"""