@ -226,6 +226,7 @@ class receiveDataThread(QThread):
self.initiatedConnection=False
else:
self.initiatedConnection=True
self.ackDataThatWeHaveYetToSend=[]#When we receive a message bound for us, we store the acknowledgement that we need to send (the ackdata) here until we are done processing all other data received from this peer.
defrun(self):
@ -288,7 +289,7 @@ class receiveDataThread(QThread):
self.data=""
ifverbose>=2:
printLock.acquire()
sys.stderr.write('The magic bytes were not correct. This may indicate a problem with the program code, or a transmission error occurred.\n')
sys.stderr.write('The magic bytes were not correct.\n')
printLock.release()
eliflen(self.data)<20:#if so little of the data has arrived that we can't even unpack the payload length
pass
@ -340,19 +341,22 @@ class receiveDataThread(QThread):
print'Inventory (in memory) already has object the hash of which we received in an inv message.'
print'Inventory (in memory) already has object listed in inv message.'
delself.objectsThatWeHaveYetToGet[objectHash]
elifisInSqlInventory(objectHash):
print'Inventory (SQL on disk) already has object the hash of which we received in an inv message.'
print'Inventory (SQL on disk) already has object listed in inv message.'
delself.objectsThatWeHaveYetToGet[objectHash]
else:
print'processData function making request for object:',repr(objectHash)
self.sendgetdata(objectHash)
delself.objectsThatWeHaveYetToGet[objectHash]#It is possible that the remote node doesn't respond with the object. In that case, we'll very likely get it from someone else anyway.
break
printLock.acquire()
print'within processData, length of objectsThatWeHaveYetToGet is now',len(self.objectsThatWeHaveYetToGet)
printLock.release()
iflen(self.objectsThatWeHaveYetToGet)>0:
printLock.acquire()
print'within processData, number of objectsThatWeHaveYetToGet is now',len(self.objectsThatWeHaveYetToGet)
printLock.release()
iflen(self.ackDataThatWeHaveYetToSend)>0:
self.data=self.ackDataThatWeHaveYetToSend.pop()
self.processData()
else:
print'Checksum incorrect. Clearing this message.'
@ -541,7 +545,6 @@ class receiveDataThread(QThread):
ifmessageEncodingType==2:
bodyPositionIndex=string.find(message,'\nBody:')
print'bodyPositionIndex',bodyPositionIndex
ifbodyPositionIndex>1:
subject=message[8:bodyPositionIndex]
body=message[bodyPositionIndex+6:]
@ -781,7 +784,7 @@ class receiveDataThread(QThread):
@ -799,7 +802,7 @@ class receiveDataThread(QThread):
#We'll need to make sure that our client will properly process the ackData; if the packet is malformed, we could clear out self.data and an attacker could use that behavior to determine that we were capable of decoding this message.
ackDataValidThusFar=True
iflen(ackData)<24:
print'The length of Ackdata is unreasonably short. Not sending ackData.'
print'The length of ackData is unreasonably short. Not sending ackData.'
ackDataValidThusFar=False
ifackData[0:4]!='\xe9\xbe\xb4\xd9':
print'Ackdata magic bytes were wrong. Not sending ackData.'
@ -811,7 +814,8 @@ class receiveDataThread(QThread):
toAddressesList=list(set(toAddressesList))#remove duplicate addresses. If the user has one address with a BM- and the same address without the BM-, this will not catch it. They'll send the message to the person twice.
@ -2768,6 +2772,7 @@ class MyForm(QtGui.QMainWindow):
print'Status bar!','Error: you must specify a From address.'
self.statusBar().showMessage('Error: You must specify a From address. If you don''t have one, go to the ''Your Identities'' tab.')
else:
toAddress=addBMIfNotPresent(toAddress)
self.statusBar().showMessage('')
ifconnectionsCount[streamNumber]==0:
self.statusBar().showMessage('Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.')
@ -3017,7 +3022,7 @@ class MyForm(QtGui.QMainWindow):
ifself.NewSubscriptionDialogInstance.ui.labelSubscriptionAddressCheck.text()=='Address is valid.':
#First we must check to see if the address is already in the address book. The user cannot add it again or else it will cause problems when updating and deleting the entry.
sqlSubmitQueue.put('''INSERT INTO addressbook VALUES (?,?)''')
sqlSubmitQueue.put(t)
@ -3048,7 +3053,7 @@ class MyForm(QtGui.QMainWindow):
ifself.NewSubscriptionDialogInstance.ui.labelSubscriptionAddressCheck.text()=='Address is valid.':
#First we must check to see if the address is already in the address book. The user cannot add it again or else it will cause problems when updating and deleting the entry.
sqlSubmitQueue.put('''INSERT INTO subscriptions VALUES (?,?,?)''')
sqlSubmitQueue.put(t)
@ -3175,7 +3180,7 @@ class MyForm(QtGui.QMainWindow):
ifself.NewBlacklistDialogInstance.ui.labelSubscriptionAddressCheck.text()=='Address is valid.':
#First we must check to see if the address is already in the address book. The user cannot add it again or else it will cause problems when updating and deleting the entry.