@ -116,13 +116,18 @@ class receiveDataThread(threading.Thread):
iflen(self.data)<24:# if so little of the data has arrived that we can't even read the checksum then wait for more data.
return
ifself.data[0:4]!='\xe9\xbe\xb4\xd9':
ifshared.verbose>=1:
with shared.printLock:
print 'The magic bytes were not correct. First 40 bytes of data: ' + repr(self.data[0:40])
#if shared.verbose >= 1:
# with shared.printLock:
# print 'The magic bytes were not correct. First 40 bytes of data: ' + repr(self.data[0:40])
self.data=""
return
self.payloadLength,=unpack('>L',self.data[16:20])
ifself.payloadLength>20000000:
logger.info('The incoming message, which we have not yet download, is too large. Ignoring it. (unfortunately there is no way to tell the other node to stop sending it except to disconnect.) Message size: %s'%self.payloadLength)
self.data=self.data[self.payloadLength+24:]
self.processData()
return
iflen(self.data)<self.payloadLength+24:# check if the whole message has arrived yet.
return
ifself.data[20:24]!=hashlib.sha512(self.data[24:self.payloadLength+24]).digest()[0:4]:# test the checksum in the message. If it is correct...
@ -137,35 +142,35 @@ class receiveDataThread(threading.Thread):
ifself.payloadLength<=180000000:# If the size of the message is greater than 180MB, ignore it. (I get memory errors when processing messages much larger than this though it is concievable that this value will have to be lowered if some systems are less tolarant of large messages.)