From d8135d6f25e6c769f4fe79b2f3a88d00482cb1f1 Mon Sep 17 00:00:00 2001 From: "Brint E. Kriebel" Date: Thu, 20 May 2021 15:46:15 -0700 Subject: [PATCH] connect: Check connection status and return sooner if failed This prevents trying to continue taking action when the connection isn't established yet. --- scripts/jitsirtc.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/jitsirtc.js b/scripts/jitsirtc.js index a736869..c663763 100644 --- a/scripts/jitsirtc.js +++ b/scripts/jitsirtc.js @@ -108,8 +108,13 @@ class JitsiRTCClient extends AVClient { // Set the connection as active this._active = true; - // TODO check for success with these before returning? - await this._connectServer(this.settings.get("world", "server")); + // Attempt to connect to the server + const serverConnected = await this._connectServer(this.settings.get("world", "server")); + if (!serverConnected) { + this.onError("Server connection failed"); + return false; + } + await this._initializeLocal(this.settings.client); const jitsiId = this._jitsiConference.myUserId();