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

Merge pull request #1104 from matrix-org/uhoreg/ignore_verification_done

ignore m.key.verification.done messages when we don't expect any more messages
This commit is contained in:
Hubert Chathi
2019-12-10 09:27:22 -05:00
committed by GitHub
2 changed files with 24 additions and 6 deletions

View File

@@ -111,10 +111,14 @@ export default class VerificationBase extends EventEmitter {
if (this._done) {
return;
} else if (e.getType() === this._expectedEvent) {
this._expectedEvent = undefined;
this._rejectEvent = undefined;
this._resetTimer();
this._resolveEvent(e);
// if we receive an expected m.key.verification.done, then just
// ignore it, since we don't need to do anything about it
if (this._expectedEvent !== "m.key.verification.done") {
this._expectedEvent = undefined;
this._rejectEvent = undefined;
this._resetTimer();
this._resolveEvent(e);
}
} else if (e.getType() === "m.key.verification.cancel") {
const reject = this._reject;
this._reject = undefined;

View File

@@ -270,7 +270,14 @@ export default class SAS extends Base {
[e] = await Promise.all([
this._waitForEvent("m.key.verification.mac"),
this._waitForEvent("m.key.verification.mac")
.then((e) => {
// we don't expect any more messages from the other
// party, and they may send a m.key.verification.done
// when they're done on their end
this._expectedEvent = "m.key.verification.done";
return e;
}),
verifySAS,
]);
content = e.getContent();
@@ -347,7 +354,14 @@ export default class SAS extends Base {
[e] = await Promise.all([
this._waitForEvent("m.key.verification.mac"),
this._waitForEvent("m.key.verification.mac")
.then((e) => {
// we don't expect any more messages from the other
// party, and they may send a m.key.verification.done
// when they're done on their end
this._expectedEvent = "m.key.verification.done";
return e;
}),
verifySAS,
]);
content = e.getContent();