@ -235,7 +235,7 @@ class receiveDataThread(QThread):
self.selfInitiatedConnectionList.append(self)
self.payloadLength=0#This is the protocol payload length thus it doesn't include the 24 byte message header
self.receivedgetbiginv=False#Gets set to true once we receive a getbiginv message from our peer. An abusive peer might request it too much so we use this variable to check whether they have already asked for a big inv message.
connectedHostsList[self.HOST]=0#The very fact that this receiveData thread exists shows that we are connected to the remote host. Let's add it to this list so that the outgoingSynSender thread doesn't try to connect to it.
self.connectionIsOrWasFullyEstablished=False#set to true after the remote node and I accept each other's version messages. This is needed to allow the user interface to accurately reflect the current number of connections.
ifself.streamNumber==-1:#This was an incoming connection. Send out a version message if we accept the other node's version message.
@ -357,27 +357,27 @@ class receiveDataThread(QThread):
self.data=self.data[self.payloadLength+24:]#take this message out and then process the next message
#print 'processData function making request for object:', objectHash.encode('hex')
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.
delself.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave[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.
print'within processData, number of objectsThatWeHaveYetToGet is now',len(self.objectsThatWeHaveYetToGet)
print'within processData, number of objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave is now',len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave)
printLock.release()
iflen(self.ackDataThatWeHaveYetToSend)>0:
self.data=self.ackDataThatWeHaveYetToSend.pop()
@ -476,9 +476,9 @@ class receiveDataThread(QThread):
print'The stream number encoded in this msg ('+streamNumberAsClaimedByMsg+') message does not match the stream number on which it was received. Ignoring it.'
print'The stream number encoded in this msg ('+str(streamNumberAsClaimedByMsg)+') message does not match the stream number on which it was received. Ignoring it.'
print'We have already received this msg message. Ignoring.'
@ -925,9 +923,9 @@ class receiveDataThread(QThread):
ifackDataValidThusFar:
print'ackData is valid. Will process it.'
self.ackDataThatWeHaveYetToSend.append(ackData)#When we have processed all data, the processData function will pop the ackData out and process it as if it is a message received from our peer.
return
#This section is for my RSA keys (version 1 addresses). If we don't have any version 1 addresses, then it won't matter.
#This section is for my RSA keys (version 1 addresses). If we don't have any version 1 addresses it will never run. This code will soon be removed.
print'We have already received this pubkey. Ignoring it.'
inventoryLock.release()
return
elifisInSqlInventory(inventoryHash):
print'We have already received this pubkey (it is stored on disk in the SQL inventory). Ignoring it.'
inventoryLock.release()
return
readPosition=24#for the message header
readPosition+=8#for the nonce
embeddedTime,=unpack('>I',self.data[readPosition:readPosition+4])#We currently are not checking the embeddedTime for any sort of validity in pubkey messages.
@ -1158,6 +1144,16 @@ class receiveDataThread(QThread):
print'stream number embedded in this pubkey doesn\'t match our stream number. Ignoring.'
foriinrange(numberOfItemsInInv):#upon finishing dealing with an incoming message, the receiveDataThread will request a random object from the peer. This way if we get multiple inv messages from multiple peers which list mostly the same objects, we will make getdata requests for different random objects from the various peers.
#print 'Adding object to self.objectsThatWeHaveYetToGet.'
#This code which deals with old RSA addresses will soon be removed.
elifself.addressVersionNumber==1:
statusbar='Generating new '+str(config.getint('bitmessagesettings','bitstrength'))+' bit RSA key. This takes a minute on average. If you want to generate multiple addresses now, you can; they will queue.'
self.actionAddSenderToAddressBook=self.ui.inboxContextMenuToolbar.addAction("Add sender to your Address Book",self.on_action_InboxAddSenderToAddressBook)
self.actionTrashInboxMessage=self.ui.inboxContextMenuToolbar.addAction("Move to Trash",self.on_action_InboxTrash)
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.
@ -3955,9 +3954,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.
@ -4025,12 +4022,6 @@ class MyForm(QtGui.QMainWindow):
print'new address dialog box rejected'
defcloseEvent(self,event):
broadcastToSendDataQueues((0,'shutdown','all'))
print'Closing. Flushing inventory in memory out to disk...'
self.statusBar().showMessage('Flushing inventory in memory out to disk.')
flushInventory()
'''quit_msg = "Are you sure you want to exit Bitmessage?"
# Check the Major version, the first element in the array
ifsqlite3.sqlite_version_info[0]<3:
print'This program requires sqlite version 3 or higher because 2 and lower cannot store NULL values. I see version:',sqlite3.sqlite_version_info
@ -4430,19 +4426,22 @@ if __name__ == "__main__":
print'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.'
raiseSystemExit
#DNS bootstrap method. Note that this lookup doesn't use the proxy server if configured; adding that feature will require more careful testing to verify that it is working.
print'Adding',item[4][0],'to knownNodes based on DNS boostrap method'
knownNodes[1][item[4][0]]=(8444,int(time.time()))
except:
print'bootstrap8444.bitmessage.org DNS bootstrapping failed.'
#DNS bootstrap. This could be programmed to use the SOCKS proxy to do the DNS lookup some day but for now we will just rely on the entries in defaultKnownNodes.py. Hopefully either they are up to date or the user has run Bitmessage recently without SOCKS turned on and received good bootstrap nodes using that method.