1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Add MatrixEvent.attemptDecryption

... and use it from both MatrixClient and the megolm re-decryption code.

This will help us avoid races when decryption is asynchronous.
This commit is contained in:
Richard van der Hoff
2017-07-18 14:41:25 +01:00
parent d37cbb10a5
commit 86f2c86440
3 changed files with 54 additions and 44 deletions

View File

@@ -842,13 +842,7 @@ MegolmDecryption.prototype._retryDecryption = function(senderKey, sessionId) {
delete this._pendingEvents[k];
for (let i = 0; i < pending.length; i++) {
try {
// no point sending another m.room_key_request here.
this._decryptEvent(pending[i], false);
console.log("successful re-decryption of", pending[i]);
} catch (e) {
console.log("Still can't decrypt", pending[i], e.stack || e);
}
pending[i].attemptDecryption(this._crypto);
}
};