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 {
|
||||
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) {
|
||||
const olmSas = new olm.SAS();
|
||||
this.olmSas = olmSas;
|
||||
try {
|
||||
const options = { room, ourUser, otherUserId, log, olmSas, olmUtil };
|
||||
let stage: BaseSASVerificationStage = new StartVerificationStage(options);
|
||||
@ -51,15 +53,19 @@ export class SASVerification {
|
||||
console.log("startStage", this.startStage);
|
||||
}
|
||||
finally {
|
||||
olmSas.free();
|
||||
}
|
||||
}
|
||||
|
||||
async start() {
|
||||
let stage = this.startStage;
|
||||
do {
|
||||
await stage.completeStage();
|
||||
stage = stage.nextStage;
|
||||
} while (stage);
|
||||
try {
|
||||
let stage = this.startStage;
|
||||
do {
|
||||
await stage.completeStage();
|
||||
stage = stage.nextStage;
|
||||
} while (stage);
|
||||
}
|
||||
finally {
|
||||
this.olmSas.free();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user