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)
|
self.object.objectType, self.object.streamNumber, self.payload[objectOffset:], self.object.expiresTime, self.object.tag)
|
||||||
objectProcessorQueue.put((self.object.objectType,self.object.data))
|
objectProcessorQueue.put((self.object.objectType,self.object.data))
|
||||||
#DownloadQueue().task_done(self.object.inventoryHash)
|
#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, self))
|
||||||
invQueue.put((self.object.streamNumber, self.object.inventoryHash))
|
|
||||||
#ObjUploadQueue().put(UploadElem(self.object.streamNumber, self.object.inventoryHash))
|
#ObjUploadQueue().put(UploadElem(self.object.streamNumber, self.object.inventoryHash))
|
||||||
#broadcastToSendDataQueues((streamNumber, 'advertiseobject', inventoryHash))
|
#broadcastToSendDataQueues((streamNumber, 'advertiseobject', inventoryHash))
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -34,7 +34,7 @@ class BMConnectionPool(object):
|
||||||
|
|
||||||
self.bootstrapped = False
|
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():
|
for i in self.inboundConnections.values() + self.outboundConnections.values():
|
||||||
if not isinstance(i, network.bmproto.BMProto):
|
if not isinstance(i, network.bmproto.BMProto):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -34,7 +34,11 @@ class InvThread(threading.Thread, StoppableThread):
|
||||||
while not state.shutdown:
|
while not state.shutdown:
|
||||||
while True:
|
while True:
|
||||||
try:
|
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)
|
self.holdHash (stream, hash)
|
||||||
#print "Holding hash %i, %s" % (stream, hexlify(hash))
|
#print "Holding hash %i, %s" % (stream, hexlify(hash))
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
|
|
Reference in New Issue
Block a user