Page MenuHomePhabricator

D13901.diff
No OneTemporary

D13901.diff

diff --git a/lib/tunnelbroker/use-peer-to-peer-message-handler.js b/lib/tunnelbroker/use-peer-to-peer-message-handler.js
--- a/lib/tunnelbroker/use-peer-to-peer-message-handler.js
+++ b/lib/tunnelbroker/use-peer-to-peer-message-handler.js
@@ -323,6 +323,21 @@
);
return;
}
+
+ if (errorMessage.includes(olmSessionErrors.alreadyDecrypted)) {
+ const sqliteMessages = await sqliteAPI.getInboundP2PMessagesByID([
+ messageID,
+ ]);
+ if (sqliteMessages.length > 0) {
+ console.log(
+ 'Message skipped because it was already decrypted ' +
+ `messageId: ${messageID}` +
+ `sender: ${message.senderInfo.deviceID}.`,
+ );
+ return;
+ }
+ }
+
console.log(
'Error decrypting message from device ' +
`${message.senderInfo.deviceID}: ${errorMessage}`,
diff --git a/lib/utils/olm-utils.js b/lib/utils/olm-utils.js
--- a/lib/utils/olm-utils.js
+++ b/lib/utils/olm-utils.js
@@ -128,6 +128,7 @@
// the corresponding .cpp file
// at `native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp`.
invalidSessionVersion: 'INVALID_SESSION_VERSION',
+ alreadyDecrypted: `${OLM_SESSION_ERROR_PREFIX}ALREADY_DECRYPTED_OR_KEYS_SKIPPED`,
});
function hasHigherDeviceID(

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 9:41 AM (14 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2451118
Default Alt Text
D13901.diff (1 KB)

Event Timeline