fix truncation of received ackdata in objectProcessor

This commit is contained in:
f97ada87 2017-09-25 19:12:00 +10:00
parent 1798c90622
commit dbd12ab8b4
No known key found for this signature in database
GPG Key ID: 07B327EEF97ADA87

View File

@ -97,14 +97,24 @@ class objectProcessor(threading.Thread):
# Let's check whether this is a message acknowledgement bound for us. # Let's check whether this is a message acknowledgement bound for us.
if len(data) < 32: if len(data) < 32:
return return
if data[-32:] in shared.ackdataForWhichImWatching: readPosition = 20 # bypass the nonce, time, and object type
# chomp version number
versionNumber, varIntLength = decodeVarint(
data[readPosition:readPosition + 10])
readPosition += varIntLength
# chomp stream number
streamNumber, varIntLength = decodeVarint(
data[readPosition:readPosition + 10])
readPosition += varIntLength
if data[readPosition:] in shared.ackdataForWhichImWatching:
logger.info('This object is an acknowledgement bound for me.') logger.info('This object is an acknowledgement bound for me.')
del shared.ackdataForWhichImWatching[data[-32:]] del shared.ackdataForWhichImWatching[data[readPosition:]]
sqlExecute('UPDATE sent SET status=?, lastactiontime=? WHERE ackdata=?', sqlExecute('UPDATE sent SET status=?, lastactiontime=? WHERE ackdata=?',
'ackreceived', 'ackreceived',
int(time.time()), int(time.time()),
data[-32:]) data[readPosition:])
queues.UISignalQueue.put(('updateSentItemStatusByAckdata', (data[-32:], tr._translate("MainWindow",'Acknowledgement of the message received %1').arg(l10n.formatTimestamp())))) queues.UISignalQueue.put(('updateSentItemStatusByAckdata', (data[readPosition:], tr._translate("MainWindow",'Acknowledgement of the message received %1').arg(l10n.formatTimestamp()))))
else: else:
logger.debug('This object is not an acknowledgement bound for me.') logger.debug('This object is not an acknowledgement bound for me.')