Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
livekit: patch
livekit-api: patch
livekit-ffi: patch
---

refactor(signaling): explicit signal lifecycle state machine - #1402 (@lukasIO)
16 changes: 16 additions & 0 deletions .changeset/signal_state_enum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
livekit-signaling: patch
---

# Model the signal connection lifecycle as an explicit state machine

`SignalInner` tracked its lifecycle in two fields, a stream slot and a `reconnecting` flag,
that had to be kept in step by hand. It now holds one `SignalState` that owns the transport
(`Connected`, `Reconnecting`, `Offline`, `Disconnecting`, `Closed`). Every change goes through one
Comment on lines +1 to +9

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: this file and .changeset/refactor_signaling_explicit_signal_lifecycle_state_machine.md look to be semantically identical?

transition table, and an input a state does not accept is logged and refused. A resume
started from a state that cannot accept it now fails with `SignalError::InvalidState`
instead of proceeding.

The held-signal queue moved to a sync lock that is never held across an await, which removes
a lock-order hazard between the queue and the stream lock. A send that fails for any
transport error is now held like a `SendError` was.
Loading
Loading