mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-02-02 07:31:38 +01:00
Free olmSas after all stages have completed
This commit is contained in:
parent
3321859ae6
commit
5e1dca946b
@ -26,9 +26,11 @@ type Olm = typeof OlmNamespace;
|
|||||||
|
|
||||||
export class SASVerification {
|
export class SASVerification {
|
||||||
private startStage: BaseSASVerificationStage;
|
private startStage: BaseSASVerificationStage;
|
||||||
|
private olmSas: Olm.SAS;
|
||||||
|
|
||||||
constructor(private room: Room, private olm: Olm, private olmUtil: Olm.Utility, private ourUser: UserData, otherUserId: string, log: ILogItem) {
|
constructor(private room: Room, private olm: Olm, private olmUtil: Olm.Utility, private ourUser: UserData, otherUserId: string, log: ILogItem) {
|
||||||
const olmSas = new olm.SAS();
|
const olmSas = new olm.SAS();
|
||||||
|
this.olmSas = olmSas;
|
||||||
try {
|
try {
|
||||||
const options = { room, ourUser, otherUserId, log, olmSas, olmUtil };
|
const options = { room, ourUser, otherUserId, log, olmSas, olmUtil };
|
||||||
let stage: BaseSASVerificationStage = new StartVerificationStage(options);
|
let stage: BaseSASVerificationStage = new StartVerificationStage(options);
|
||||||
@ -51,15 +53,19 @@ export class SASVerification {
|
|||||||
console.log("startStage", this.startStage);
|
console.log("startStage", this.startStage);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
olmSas.free();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
|
try {
|
||||||
let stage = this.startStage;
|
let stage = this.startStage;
|
||||||
do {
|
do {
|
||||||
await stage.completeStage();
|
await stage.completeStage();
|
||||||
stage = stage.nextStage;
|
stage = stage.nextStage;
|
||||||
} while (stage);
|
} while (stage);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
this.olmSas.free();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user