1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Remove some dead code from _retryDecryption

I think this was attempting to remove the events from _pendingEvents
but a) it wasn't and b) it probably shouldn't be because the retry
itself will re-add them when the decryption attempt starts and remove
them if it succeeds.

Also fix what was presumably a c+p fail.
This commit is contained in:
David Baker
2020-04-24 14:36:42 +01:00
parent 991457496f
commit 21d3dd4506
2 changed files with 4 additions and 9 deletions

View File

@@ -1581,7 +1581,8 @@ MegolmDecryption.prototype.importRoomKey = function(session) {
}; };
/** /**
* Have another go at decrypting events after we receive a key * Have another go at decrypting events after we receive a key. Resolves once
* decryption has been re-attempted on all events.
* *
* @private * @private
* @param {String} senderKey * @param {String} senderKey
@@ -1600,11 +1601,6 @@ MegolmDecryption.prototype._retryDecryption = async function(senderKey, sessionI
return true; return true;
} }
pending.delete(sessionId);
if (pending.size === 0) {
this._pendingEvents[senderKey];
}
await Promise.all([...pending].map(async (ev) => { await Promise.all([...pending].map(async (ev) => {
try { try {
await ev.attemptDecryption(this._crypto); await ev.attemptDecryption(this._crypto);
@@ -1613,8 +1609,7 @@ MegolmDecryption.prototype._retryDecryption = async function(senderKey, sessionI
} }
})); }));
// ev.attemptDecryption will re-add to this._pendingEvents if an event // If decrypted successfully, they'll have been removed from _pendingEvents
// couldn't be decrypted
return !((this._pendingEvents[senderKey] || {})[sessionId]); return !((this._pendingEvents[senderKey] || {})[sessionId]);
}; };

View File

@@ -406,7 +406,7 @@ utils.extend(MatrixEvent.prototype, {
) { ) {
// we may want to just ignore this? let's start with rejecting it. // we may want to just ignore this? let's start with rejecting it.
throw new Error( throw new Error(
"Attempt to decrypt event which has already been encrypted", "Attempt to decrypt event which has already been decrypted",
); );
} }