From 5ee4e39bc78eb2ab28b7c7ac26379fd219ec8195 Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Wed, 11 May 2022 10:06:05 +0200 Subject: [PATCH 1/2] add return type --- src/matrix/calls/CallHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matrix/calls/CallHandler.ts b/src/matrix/calls/CallHandler.ts index 92f7314c..07ed8492 100644 --- a/src/matrix/calls/CallHandler.ts +++ b/src/matrix/calls/CallHandler.ts @@ -40,7 +40,7 @@ export type Options = Omit & { clock: Clock }; -function getRoomMemberKey(roomId: string, userId: string) { +function getRoomMemberKey(roomId: string, userId: string): string { return JSON.stringify(roomId)+`,`+JSON.stringify(userId); } From a923e7e5e1ef22aabdb615cd52d1c9acfbe7b5da Mon Sep 17 00:00:00 2001 From: Bruno Windels <274386+bwindels@users.noreply.github.com> Date: Wed, 11 May 2022 13:14:23 +0200 Subject: [PATCH 2/2] don't pass errors as log levels --- src/matrix/calls/PeerCall.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/matrix/calls/PeerCall.ts b/src/matrix/calls/PeerCall.ts index 963d6c30..e6ce3571 100644 --- a/src/matrix/calls/PeerCall.ts +++ b/src/matrix/calls/PeerCall.ts @@ -438,7 +438,7 @@ export class PeerCall implements IDisposable { if (this.callId! > newCallId) { log.log( "Glare detected: answering incoming call " + newCallId + - " and canceling outgoing call ", + " and canceling outgoing call " ); // How do we interrupt `call()`? well, perhaps we need to not just await InviteSent but also CreateAnswer? if (this._state === CallState.Fledgling || this._state === CallState.CreateOffer) { @@ -452,7 +452,7 @@ export class PeerCall implements IDisposable { } else { log.log( "Glare detected: rejecting incoming call " + newCallId + - " and keeping outgoing call ", + " and keeping outgoing call " ); await this.sendHangupWithCallId(newCallId, CallErrorCode.Replaced, log); } @@ -625,7 +625,7 @@ export class PeerCall implements IDisposable { if (this.opponentPartyId !== partyId) { log.log( `Ignoring candidates from party ID ${partyId}: ` + - `we have chosen party ID ${this.opponentPartyId}`, + `we have chosen party ID ${this.opponentPartyId}` ); return; @@ -680,7 +680,7 @@ export class PeerCall implements IDisposable { await this.sendSignallingMessage({type: EventType.Negotiate, content}, log); } } catch (err) { - log.log(`Failed to complete negotiation`, err); + log.log(`Failed to complete negotiation`).catch(err); } } @@ -801,12 +801,12 @@ export class PeerCall implements IDisposable { log.log(`Ignoring remote ICE candidate with no sdpMid or sdpMLineIndex`); continue; } - log.log(`Got remote ICE ${candidate.sdpMid} candidate: ${candidate.candidate}`); + const logItem = log.log(`Adding remote ICE ${candidate.sdpMid} candidate: ${candidate.candidate}`); try { await this.peerConnection.addIceCandidate(candidate); } catch (err) { if (!this.ignoreOffer) { - log.log(`Failed to add remote ICE candidate`, err); + logItem.catch(err); } } }