mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Don't send redundant updates to new contacts.
This commit is contained in:
@@ -305,14 +305,17 @@ class ClientVersioningManagerImpl implements ClientVersioningManager, Client,
|
|||||||
Update oldLocalUpdate = loadUpdate(txn, latest.local.messageId);
|
Update oldLocalUpdate = loadUpdate(txn, latest.local.messageId);
|
||||||
List<ClientState> oldLocalStates = oldLocalUpdate.states;
|
List<ClientState> oldLocalStates = oldLocalUpdate.states;
|
||||||
long oldLocalUpdateVersion = oldLocalUpdate.updateVersion;
|
long oldLocalUpdateVersion = oldLocalUpdate.updateVersion;
|
||||||
// Delete the latest local update
|
// Update the local states if necessary
|
||||||
db.deleteMessage(txn, latest.local.messageId);
|
|
||||||
db.deleteMessageMetadata(txn, latest.local.messageId);
|
|
||||||
// Store a new local update
|
|
||||||
List<ClientState> newLocalStates =
|
List<ClientState> newLocalStates =
|
||||||
updateStatesFromLocalVersions(oldLocalStates, versions);
|
updateStatesFromLocalVersions(oldLocalStates, versions);
|
||||||
storeUpdate(txn, g.getId(), newLocalStates,
|
if (!oldLocalStates.equals(newLocalStates)) {
|
||||||
oldLocalUpdateVersion + 1);
|
// Delete the latest local update
|
||||||
|
db.deleteMessage(txn, latest.local.messageId);
|
||||||
|
db.deleteMessageMetadata(txn, latest.local.messageId);
|
||||||
|
// Store a new local update
|
||||||
|
storeUpdate(txn, g.getId(), newLocalStates,
|
||||||
|
oldLocalUpdateVersion + 1);
|
||||||
|
}
|
||||||
// Load and parse the latest remote update, if any
|
// Load and parse the latest remote update, if any
|
||||||
List<ClientState> remoteStates;
|
List<ClientState> remoteStates;
|
||||||
if (latest.remote == null) remoteStates = emptyList();
|
if (latest.remote == null) remoteStates = emptyList();
|
||||||
|
|||||||
Reference in New Issue
Block a user