From 681b6b0b0f81add4c05ede61baac545e0f38d996 Mon Sep 17 00:00:00 2001 From: Christopher Poile Date: Mon, 3 Oct 2022 13:12:02 -0400 Subject: [PATCH] MM-47003 - Calls - Fix for: peer connection timeout (#6658) * force negotiation * fix message bug * remove forced negotiation --- app/products/calls/connection/connection.ts | 6 +++--- app/products/calls/state/actions.ts | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/products/calls/connection/connection.ts b/app/products/calls/connection/connection.ts index f02dec4ec8..692a1809a0 100644 --- a/app/products/calls/connection/connection.ts +++ b/app/products/calls/connection/connection.ts @@ -231,15 +231,15 @@ export async function newConnection(serverUrl: string, channelID: string, closeC ws.on('message', ({data}: { data: string }) => { const msg = JSON.parse(data); - if (msg.type === 'answer' || msg.type === 'offer') { + if (msg.type === 'answer' || msg.type === 'candidate' || msg.type === 'offer') { peer?.signal(data); } }); const waitForPeerConnection = () => { - const waitForReadyImpl = (callback: () => void, fail: () => void, timeout: number) => { + const waitForReadyImpl = (callback: () => void, fail: (reason: string) => void, timeout: number) => { if (timeout <= 0) { - fail(); + fail('timed out waiting for peer connection'); return; } setTimeout(() => { diff --git a/app/products/calls/state/actions.ts b/app/products/calls/state/actions.ts index 28f0fb1550..4bfe8976bb 100644 --- a/app/products/calls/state/actions.ts +++ b/app/products/calls/state/actions.ts @@ -131,6 +131,12 @@ export const userLeftCall = (serverUrl: string, channelId: string, userId: strin return; } + // Was the user me? + if (userId === callsState.myUserId) { + myselfLeftCall(); + return; + } + const nextCurrentCall = { ...currentCall, participants: {...currentCall.participants},