Skip to content

Commit

Permalink
Prevent undefined access to engine in connection reconciler (#1349)
Browse files Browse the repository at this point in the history
* Prevent undefined access to engine in connection reconciler

* Create red-maps-happen.md

* also transports

* set engine undefined if it's undefined2
  • Loading branch information
lukasIO authored Dec 9, 2024
1 parent 1b0591b commit 5ef24e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-maps-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-client": patch
---

Prevent undefined access to engine in connection reconciler
10 changes: 6 additions & 4 deletions src/room/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1903,10 +1903,12 @@ class Room extends (EventEmitter as new () => TypedEmitter<RoomEventCallbacks>)
this.log.warn('detected connection state mismatch', {
...this.logContext,
numFailures: consecutiveFailures,
engine: {
closed: this.engine.isClosed,
transportsConnected: this.engine.verifyTransport(),
},
engine: this.engine
? {
closed: this.engine.isClosed,
transportsConnected: this.engine.verifyTransport(),
}
: undefined,
});
if (consecutiveFailures >= 3) {
this.recreateEngine();
Expand Down

0 comments on commit 5ef24e9

Please sign in to comment.