mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 14:49:53 +01:00
Ignore old wipe messages when receiving
This commit is contained in:
@@ -127,10 +127,12 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
|
|||||||
// txn.attach event
|
// txn.attach event
|
||||||
} else if (type == WIPE) {
|
} else if (type == WIPE) {
|
||||||
if (!remoteWipeIsSetup(txn)) return false;
|
if (!remoteWipeIsSetup(txn)) return false;
|
||||||
|
if (clock.currentTimeMillis() - m.getTimestamp() > MAX_MESSAGE_AGE) return false;
|
||||||
|
|
||||||
ContactId contactId = getContactId(txn, m.getGroupId());
|
ContactId contactId = getContactId(txn, m.getGroupId());
|
||||||
// Check if contact is in list of wipers
|
// Check if contact is in list of wipers
|
||||||
if (findMessage(txn, m.getGroupId(), SETUP, true) != null) {
|
if (findMessage(txn, m.getGroupId(), SETUP, true) != null) {
|
||||||
System.out.println("Got a wipe message from a wiper");
|
System.out.println("Got a valid wipe message from a wiper");
|
||||||
|
|
||||||
BdfDictionary existingMeta = clientHelper.getGroupMetadataAsDictionary(txn,
|
BdfDictionary existingMeta = clientHelper.getGroupMetadataAsDictionary(txn,
|
||||||
localGroup.getId());
|
localGroup.getId());
|
||||||
@@ -165,8 +167,7 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
|
|||||||
} else {
|
} else {
|
||||||
BdfList newReceivedWipeMessage = new BdfList();
|
BdfList newReceivedWipeMessage = new BdfList();
|
||||||
newReceivedWipeMessage.add(contactId.getInt());
|
newReceivedWipeMessage.add(contactId.getInt());
|
||||||
long timestamp = m.getTimestamp();
|
newReceivedWipeMessage.add(m.getTimestamp());
|
||||||
newReceivedWipeMessage.add(timestamp);
|
|
||||||
receivedWipeMessages.add(newReceivedWipeMessage);
|
receivedWipeMessages.add(newReceivedWipeMessage);
|
||||||
BdfDictionary newMeta = new BdfDictionary();
|
BdfDictionary newMeta = new BdfDictionary();
|
||||||
newMeta.put(GROUP_KEY_RECEIVED_WIPE, receivedWipeMessages);
|
newMeta.put(GROUP_KEY_RECEIVED_WIPE, receivedWipeMessages);
|
||||||
|
|||||||
Reference in New Issue
Block a user