KeyRequestHandler: clear redundant users/devices on cancellations

... otherwise _processNextRequest will get confused
This commit is contained in:
Richard van der Hoff 2017-06-05 17:26:25 +01:00
parent a3a262b150
commit 7a9784fd6e

View file

@ -88,6 +88,12 @@ export default class KeyRequestHandler {
} }
console.log("Forgetting room key request"); console.log("Forgetting room key request");
requests.splice(idx, 1); requests.splice(idx, 1);
if (requests.length === 0) {
delete this._pendingKeyRequests[userId][deviceId];
if (Object.keys(this._pendingKeyRequests[userId]).length === 0) {
delete this._pendingKeyRequests[userId];
}
}
} }
_processNextRequest() { _processNextRequest() {