ACKdata handling changes
- any type of object can now serve as ACKdata
This commit is contained in:
parent
9aacef144b
commit
c1bdcc2aba
|
@ -56,6 +56,8 @@ class objectProcessor(threading.Thread):
|
||||||
while True:
|
while True:
|
||||||
objectType, data = queues.objectProcessorQueue.get()
|
objectType, data = queues.objectProcessorQueue.get()
|
||||||
|
|
||||||
|
self.checkackdata(data)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if objectType == 0: # getpubkey
|
if objectType == 0: # getpubkey
|
||||||
self.processgetpubkey(data)
|
self.processgetpubkey(data)
|
||||||
|
@ -87,6 +89,22 @@ class objectProcessor(threading.Thread):
|
||||||
state.shutdown = 2
|
state.shutdown = 2
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def checkackdata(self, data):
|
||||||
|
# Let's check whether this is a message acknowledgement bound for us.
|
||||||
|
if len(data) < 32:
|
||||||
|
return
|
||||||
|
if data[-32:] in shared.ackdataForWhichImWatching:
|
||||||
|
logger.info('This object is an acknowledgement bound for me.')
|
||||||
|
del shared.ackdataForWhichImWatching[data[-32:]]
|
||||||
|
sqlExecute('UPDATE sent SET status=?, lastactiontime=? WHERE ackdata=?',
|
||||||
|
'ackreceived',
|
||||||
|
int(time.time()),
|
||||||
|
data[-32:])
|
||||||
|
queues.UISignalQueue.put(('updateSentItemStatusByAckdata', (data[-32:], tr._translate("MainWindow",'Acknowledgement of the message received %1').arg(l10n.formatTimestamp()))))
|
||||||
|
else:
|
||||||
|
logger.debug('This object is not an acknowledgement bound for me.')
|
||||||
|
|
||||||
|
|
||||||
def processgetpubkey(self, data):
|
def processgetpubkey(self, data):
|
||||||
readPosition = 20 # bypass the nonce, time, and object type
|
readPosition = 20 # bypass the nonce, time, and object type
|
||||||
requestedAddressVersionNumber, addressVersionLength = decodeVarint(
|
requestedAddressVersionNumber, addressVersionLength = decodeVarint(
|
||||||
|
@ -322,19 +340,6 @@ class objectProcessor(threading.Thread):
|
||||||
readPosition += streamNumberAsClaimedByMsgLength
|
readPosition += streamNumberAsClaimedByMsgLength
|
||||||
inventoryHash = calculateInventoryHash(data)
|
inventoryHash = calculateInventoryHash(data)
|
||||||
initialDecryptionSuccessful = False
|
initialDecryptionSuccessful = False
|
||||||
# Let's check whether this is a message acknowledgement bound for us.
|
|
||||||
if data[-32:] in shared.ackdataForWhichImWatching:
|
|
||||||
logger.info('This msg IS an acknowledgement bound for me.')
|
|
||||||
del shared.ackdataForWhichImWatching[data[-32:]]
|
|
||||||
sqlExecute('UPDATE sent SET status=?, lastactiontime=? WHERE ackdata=?',
|
|
||||||
'ackreceived',
|
|
||||||
int(time.time()),
|
|
||||||
data[-32:])
|
|
||||||
queues.UISignalQueue.put(('updateSentItemStatusByAckdata', (data[-32:], tr._translate("MainWindow",'Acknowledgement of the message received %1').arg(l10n.formatTimestamp()))))
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
logger.info('This was NOT an acknowledgement bound for me.')
|
|
||||||
|
|
||||||
|
|
||||||
# This is not an acknowledgement bound for me. See if it is a message
|
# This is not an acknowledgement bound for me. See if it is a message
|
||||||
# bound for me by trying to decrypt it with my private keys.
|
# bound for me by trying to decrypt it with my private keys.
|
||||||
|
|
Reference in New Issue
Block a user