preparation for switch from 32 bit time to 64 bit time in protocol

This commit is contained in:
Jonathan Warren 2013-04-17 14:32:18 -04:00
parent 11407f3f44
commit c50ab9ff9c
1 changed files with 6 additions and 4 deletions

View File

@ -1474,8 +1474,8 @@ class receiveDataThread(QThread):
printLock.acquire() printLock.acquire()
print 'knownNodes currently has', len(knownNodes[self.streamNumber]), 'nodes for this stream.' print 'knownNodes currently has', len(knownNodes[self.streamNumber]), 'nodes for this stream.'
printLock.release() printLock.release()
elif self.remoteProtocolVersion == 2: elif self.remoteProtocolVersion >= 2: #The difference is that in protocol version 2, network addresses use 64 bit times rather than 32 bit times.
print 'self.remoteProtocolVersion == 2' print 'self.remoteProtocolVersion =', self.remoteProtocolVersion
if numberOfAddressesIncluded > 1000 or numberOfAddressesIncluded == 0: if numberOfAddressesIncluded > 1000 or numberOfAddressesIncluded == 0:
return return
if len(data) != lengthOfNumberOfAddresses + (38 * numberOfAddressesIncluded): if len(data) != lengthOfNumberOfAddresses + (38 * numberOfAddressesIncluded):
@ -1728,7 +1728,7 @@ class receiveDataThread(QThread):
def sendversion(self): def sendversion(self):
global softwareVersion global softwareVersion
payload = '' payload = ''
payload += pack('>L',1) #protocol version. payload += pack('>L',2) #protocol version.
payload += pack('>q',1) #bitflags of the services I offer. payload += pack('>q',1) #bitflags of the services I offer.
payload += pack('>q',int(time.time())) payload += pack('>q',int(time.time()))
@ -1806,7 +1806,7 @@ class sendDataThread(QThread):
#Note that there is another copy of this version-sending code in the receiveData class which would need to be changed if you make changes here. #Note that there is another copy of this version-sending code in the receiveData class which would need to be changed if you make changes here.
global softwareVersion global softwareVersion
payload = '' payload = ''
payload += pack('>L',1) #protocol version. payload += pack('>L',2) #protocol version.
payload += pack('>q',1) #bitflags of the services I offer. payload += pack('>q',1) #bitflags of the services I offer.
payload += pack('>q',int(time.time())) payload += pack('>q',int(time.time()))
@ -5309,6 +5309,8 @@ if __name__ == "__main__":
knownNodes = pickle.load(pickleFile) knownNodes = pickle.load(pickleFile)
pickleFile.close() pickleFile.close()
print knownNodes
if config.getint('bitmessagesettings', 'settingsversion') > 4: if config.getint('bitmessagesettings', 'settingsversion') > 4:
print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.' print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.'
raise SystemExit raise SystemExit