Skip to content

Commit

Permalink
connect: Check connection status and return sooner if failed
Browse files Browse the repository at this point in the history
This prevents trying to continue taking action when the connection isn't
established yet.
  • Loading branch information
bekriebel committed May 31, 2021
1 parent 747aa8e commit d8135d6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/jitsirtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d8135d6

Please sign in to comment.