some more cleanup

This commit is contained in:
Bruno Windels 2022-04-28 16:52:17 +01:00
parent 2d9b69751f
commit 3d83fda69f

View File

@ -123,7 +123,9 @@ export class Member {
this.peerCall = undefined; this.peerCall = undefined;
this.localMedia?.dispose(); this.localMedia?.dispose();
this.localMedia = undefined; this.localMedia = undefined;
this.localMuteSettings = undefined;
this.retryCount = 0; this.retryCount = 0;
this.logItem.finish();
}); });
} }
@ -158,8 +160,12 @@ export class Member {
/** @internal */ /** @internal */
emitUpdate = (peerCall: PeerCall, params: any) => { emitUpdate = (peerCall: PeerCall, params: any) => {
// these must be set as the update comes from the peerCall,
// which only exists when these are set
const localMedia = this.localMedia!;
const localMuteSettings = this.localMuteSettings!;
if (peerCall.state === CallState.Ringing) { if (peerCall.state === CallState.Ringing) {
peerCall.answer(this.localMedia!, this.localMuteSettings!); peerCall.answer(localMedia, localMuteSettings);
} }
else if (peerCall.state === CallState.Ended) { else if (peerCall.state === CallState.Ended) {
const hangupReason = peerCall.hangupReason; const hangupReason = peerCall.hangupReason;
@ -168,7 +174,7 @@ export class Member {
if (hangupReason && !errorCodesWithoutRetry.includes(hangupReason)) { if (hangupReason && !errorCodesWithoutRetry.includes(hangupReason)) {
this.retryCount += 1; this.retryCount += 1;
if (this.retryCount <= 3) { if (this.retryCount <= 3) {
this.connect(this.localMedia!, this.localMuteSettings!); this.connect(localMedia, localMuteSettings);
} }
} }
} }