From ccff9edb1c7102cfcc846561a3bdc41fc1496df9 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sat, 26 Feb 2022 18:48:53 +0100 Subject: Handle to-device messages before handling roomdata Probably improves the performance slightly If we handle to room data first, if a message arrives at the same time as the to-device message containing the key and we handle the message first, it will not be decryptable and stored as undecrypted. Then, when the key is handled, the cache of undecrypted messages is searched, the message decrypted and replaced. When handling the key first, the message can be decryped instantly. --- lib/connection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/connection.cpp') diff --git a/lib/connection.cpp b/lib/connection.cpp index 66df1e43..7099c59c 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -777,11 +777,11 @@ void Connection::onSyncSuccess(SyncData&& data, bool fromCache) d->consumeDevicesList(data.takeDevicesList()); #endif // Quotient_E2EE_ENABLED + d->consumeToDeviceEvents(data.takeToDeviceEvents()); d->data->setLastEvent(data.nextBatch()); d->consumeRoomData(data.takeRoomData(), fromCache); d->consumeAccountData(data.takeAccountData()); d->consumePresenceData(data.takePresenceData()); - d->consumeToDeviceEvents(data.takeToDeviceEvents()); #ifdef Quotient_E2EE_ENABLED if(d->encryptionUpdateRequired) { d->loadOutdatedUserDevices(); -- cgit v1.2.3