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
15 changes: 15 additions & 0 deletions .changeset/abort_in_flight_ffi_connect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
livekit-ffi: patch
---

# Abort in-flight FFI connect on disconnect

Cancelling `room.connect()` from a language binding left `Room::connect` running,
and a later ReadyFor timeout sent Panic into the host (python-sdks#785). Connect
now allocates an abortable handle immediately; DisconnectRequest cancels the
handshake, joins the connect task, and `close()`s any Room that already
completed (rust-sdks#1334: dropping a completed Room without close keeps
`engine_task`/`room_task` alive). Abort before `Room::connect` returns Ok does
not enter `SessionInner::close`; that leftover stays in `livekit/`. ReadyFor on
that early handle is accepted during handshake. Missed ReadyFor fails that room
instead of panicking the process.
12 changes: 12 additions & 0 deletions livekit-ffi-node-bindings/proto/room_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,18 @@ export declare class ConnectResponse extends Message<ConnectResponse> {
*/
asyncId?: bigint;

/**
* Allocated as soon as ConnectRequest is received, before Room::connect
* finishes. DisconnectRequest with this handle aborts the in-flight
* handshake and close()s any Room that already completed (rust-sdks#1334:
* dropping a completed Room without close leaks ICE sockets). Old clients
* ignore this proto2 optional field. A missed ReadyFor handshake must fail
* this room only, never Panic the host (python-sdks#785).
*
* @generated from field: optional uint64 room_handle = 2;
*/
roomHandle?: bigint;

constructor(data?: PartialMessage<ConnectResponse>);

static readonly runtime: typeof proto2;
Expand Down
1 change: 1 addition & 0 deletions livekit-ffi-node-bindings/proto/room_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ const ConnectResponse = /*@__PURE__*/ proto2.makeMessageType(
"livekit.proto.ConnectResponse",
() => [
{ no: 1, name: "async_id", kind: "scalar", T: 4 /* ScalarType.UINT64 */, req: true },
{ no: 2, name: "room_handle", kind: "scalar", T: 4 /* ScalarType.UINT64 */, opt: true },
],
);

Expand Down
7 changes: 7 additions & 0 deletions livekit-ffi/protocol/room.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ message ConnectRequest {
}
message ConnectResponse {
required uint64 async_id = 1;
// Allocated as soon as ConnectRequest is received, before Room::connect
// finishes. DisconnectRequest with this handle aborts the in-flight
// handshake and close()s any Room that already completed (rust-sdks#1334:
// dropping a completed Room without close leaks ICE sockets). Old clients
// ignore this proto2 optional field. A missed ReadyFor handshake must fail
// this room only, never Panic the host (python-sdks#785).
optional uint64 room_handle = 2;
}
message ConnectCallback {
message ParticipantWithTracks {
Expand Down
Loading
Loading