You've already forked matrix-js-sdk
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:
@@ -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]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user