Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix RPC invocation race condition #565

Merged
merged 8 commits into from
Feb 4, 2025
Merged
Changes from 2 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
4 changes: 2 additions & 2 deletions livekit-ffi/src/server/participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ async fn forward_rpc_method_invocation(
let (tx, rx) = oneshot::channel();
let invocation_id = server.next_id();

room.store_rpc_method_invocation_waiter(invocation_id, tx);

let _ = server.send_event(proto::ffi_event::Message::RpcMethodInvocation(
proto::RpcMethodInvocationEvent {
local_participant_handle: local_participant_handle as u64,
Expand All @@ -152,8 +154,6 @@ async fn forward_rpc_method_invocation(
},
));

room.store_rpc_method_invocation_waiter(invocation_id, tx);

rx.await.unwrap_or_else(|_| {
Err(RpcError {
code: RpcErrorCode::ApplicationError as u32,
Expand Down
Loading