Asyncore update
- incoming object handling fix
This commit is contained in:
parent
1ccfd41c3f
commit
7f381c0c25
|
@ -298,8 +298,7 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
|
|||
self.object.objectType, self.object.streamNumber, self.payload[objectOffset:], self.object.expiresTime, self.object.tag)
|
||||
objectProcessorQueue.put((self.object.objectType,self.object.data))
|
||||
#DownloadQueue().task_done(self.object.inventoryHash)
|
||||
network.connectionpool.BMConnectionPool().handleReceivedObject(self, self.object.streamNumber, self.object.inventoryHash)
|
||||
invQueue.put((self.object.streamNumber, self.object.inventoryHash))
|
||||
invQueue.put((self.object.streamNumber, self.object.inventoryHash, self))
|
||||
#ObjUploadQueue().put(UploadElem(self.object.streamNumber, self.object.inventoryHash))
|
||||
#broadcastToSendDataQueues((streamNumber, 'advertiseobject', inventoryHash))
|
||||
return True
|
||||
|
|
|
@ -34,7 +34,7 @@ class BMConnectionPool(object):
|
|||
|
||||
self.bootstrapped = False
|
||||
|
||||
def handleReceivedObject(self, connection, streamNumber, hashid):
|
||||
def handleReceivedObject(self, streamNumber, hashid, connection = None):
|
||||
for i in self.inboundConnections.values() + self.outboundConnections.values():
|
||||
if not isinstance(i, network.bmproto.BMProto):
|
||||
continue
|
||||
|
|
|
@ -34,7 +34,11 @@ class InvThread(threading.Thread, StoppableThread):
|
|||
while not state.shutdown:
|
||||
while True:
|
||||
try:
|
||||
(stream, hash) = invQueue.get(False)
|
||||
data = invQueue.get(False)
|
||||
if len(data) == 2:
|
||||
BMConnectionPool().handleReceivedObject(self, data[0], data[1])
|
||||
else:
|
||||
BMConnectionPool().handleReceivedObject(self, data[0], data[1], data[3])
|
||||
self.holdHash (stream, hash)
|
||||
#print "Holding hash %i, %s" % (stream, hexlify(hash))
|
||||
except Queue.Empty:
|
||||
|
|
Reference in New Issue
Block a user