diff --git a/src/matrix/calls/TurnServerSource.ts b/src/matrix/calls/TurnServerSource.ts index cac08bdf..ca0f6848 100644 --- a/src/matrix/calls/TurnServerSource.ts +++ b/src/matrix/calls/TurnServerSource.ts @@ -64,7 +64,7 @@ export class TurnServerSource { }, () => { // start loop on first subscribe - this.runLoop(this.currentObservable!, settings?.ttl ?? DEFAULT_TTL); + this.runLoop(settings?.ttl ?? DEFAULT_TTL); }); } } @@ -72,7 +72,7 @@ export class TurnServerSource { }); } - private async runLoop(observable: ObservableValue, initialTtl: number): Promise { + private async runLoop(initialTtl: number): Promise { let ttl = initialTtl; this.isPolling = true; while(this.isPolling) { @@ -83,8 +83,8 @@ export class TurnServerSource { const settings = await this.doRequest(undefined); if (settings) { const iceServer = toIceServer(settings); - if (shouldUpdate(observable, iceServer)) { - observable.set(iceServer); + if (shouldUpdate(this.currentObservable!, iceServer)) { + this.currentObservable!.set(iceServer); } if (settings.ttl > 0) { ttl = settings.ttl;