logger.debug('Saved %s objects from the objectProcessorQueue to disk. objectProcessorThread exiting.'%str(numberOfObjectsThatWereInTheObjectProcessorQueue))
shared.shutdown=2
state.shutdown=2
break
defprocessgetpubkey(self,data):
@ -286,12 +286,12 @@ class objectProcessor(threading.Thread):
return
tag=data[readPosition:readPosition+32]
iftagnotin neededPubkeys:
iftagnotinstate.neededPubkeys:
logger.info('We don\'t need this v4 pubkey. We didn\'t ask for it.')
privEncryptionKey=doubleHashOfAddressData[:32]# Note that this is the first half of the sha512 hash.
tag=doubleHashOfAddressData[32:]
neededPubkeys[tag]=(toAddress,highlevelcrypto.makeCryptor(hexlify(privEncryptionKey)))# We'll need this for when we receive a pubkey reply: it will be encrypted and we'll need to decrypt it.
state.neededPubkeys[tag]=(toAddress,highlevelcrypto.makeCryptor(hexlify(privEncryptionKey)))# We'll need this for when we receive a pubkey reply: it will be encrypted and we'll need to decrypt it.
# Initialize the shared.ackdataForWhichImWatching data structure
queryreturn=sqlQuery(
@ -76,7 +76,7 @@ class singleWorker(threading.Thread, StoppableThread):
self.stop.wait(
10)# give some time for the GUI to start before we start on existing POW tasks.
ifshared.shutdown==0:
ifstate.shutdown==0:
# just in case there are any pending tasks for msg
# messages that have yet to be sent.
shared.workerQueue.put(('sendmessage',''))
@ -84,7 +84,7 @@ class singleWorker(threading.Thread, StoppableThread):
# that have yet to be sent.
shared.workerQueue.put(('sendbroadcast',''))
whileshared.shutdown==0:
whilestate.shutdown==0:
self.busy=0
command,data=shared.workerQueue.get()
self.busy=1
@ -553,7 +553,7 @@ class singleWorker(threading.Thread, StoppableThread):
ifshared.decryptAndCheckPubkeyPayload(value.payload,toaddress)=='successful':#if valid, this function also puts it in the pubkeys table.
@ -585,7 +585,7 @@ class singleWorker(threading.Thread, StoppableThread):
sqlExecute(
'''UPDATE sent SET status='doingmsgpow', retrynumber=0 WHERE toaddress=? AND (status='msgqueued' or status='awaitingpubkey' or status='doingpubkeypow')''',
toaddress)
del neededPubkeys[tag]
delstate.neededPubkeys[tag]
break
#else: # There was something wrong with this pubkey object even
# though it had the correct tag- almost certainly because
@ -879,15 +879,15 @@ class singleWorker(threading.Thread, StoppableThread):
retryNumber=queryReturn[0][0]
ifaddressVersionNumber<=3:
neededPubkeys[toAddress]=0
state.neededPubkeys[toAddress]=0
elifaddressVersionNumber>=4:
# If the user just clicked 'send' then the tag (and other information) will already
# be in the neededPubkeys dictionary. But if we are recovering from a restart
# of the client then we have to put it in now.
privEncryptionKey=hashlib.sha512(hashlib.sha512(encodeVarint(addressVersionNumber)+encodeVarint(streamNumber)+ripe).digest()).digest()[:32]# Note that this is the first half of the sha512 hash.
tag=hashlib.sha512(hashlib.sha512(encodeVarint(addressVersionNumber)+encodeVarint(streamNumber)+ripe).digest()).digest()[32:]# Note that this is the second half of the sha512 hash.
iftagnotin neededPubkeys:
neededPubkeys[tag]=(toAddress,highlevelcrypto.makeCryptor(hexlify(privEncryptionKey)))# We'll need this for when we receive a pubkey reply: it will be encrypted and we'll need to decrypt it.
iftagnotinstate.neededPubkeys:
state.neededPubkeys[tag]=(toAddress,highlevelcrypto.makeCryptor(hexlify(privEncryptionKey)))# We'll need this for when we receive a pubkey reply: it will be encrypted and we'll need to decrypt it.
ifretryNumber==0:
TTL=2.5*24*60*60# 2.5 days. This was chosen fairly arbitrarily.
connectedHostsList={}#List of hosts to which we are connected. Used to guarantee that the outgoingSynSender threads won't connect to the same remote node twice.
shutdown=0#Set to 1 by the doCleanShutdown function. Used to tell the proof of work worker threads to exit.
thisapp=None# singleton lock instance
alreadyAttemptedConnectionsList={
}# This is a list of nodes to which we have already attempted a connection