Skip to content

Commit

Permalink
Make sure engine gets closed when connection reconciliation triggers (#…
Browse files Browse the repository at this point in the history
…702)

* Make sure engine gets closed when connection reconcilation triggers

* Create soft-turtles-appear.md
  • Loading branch information
lukasIO committed May 12, 2023
1 parent 8017220 commit b90aa33
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/soft-turtles-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-client": patch
---

Make sure engine gets closed when connection reconciliation triggers
4 changes: 3 additions & 1 deletion src/room/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1370,11 +1370,13 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
) {
consecutiveFailures++;
log.warn('detected connection state mismatch', { numFailures: consecutiveFailures });
if (consecutiveFailures >= 3)
if (consecutiveFailures >= 3) {
this.recreateEngine();
this.handleDisconnect(
this.options.stopLocalTrackOnUnpublish,
DisconnectReason.UNKNOWN_REASON,
);
}
} else {
consecutiveFailures = 0;
}
Expand Down

0 comments on commit b90aa33

Please sign in to comment.