Skip to content

Commit 7da4bc7

Browse files
authored
Fix RPC invocation race condition (#565)
* Fix race condition in rpc invocation * nanpa * fix * nanpa * cgo * sm
1 parent 660f70e commit 7da4bc7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.nanpa/rpc-race.kdl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
patch package="livekit-ffi" type="fixed" "Fix RPC invocation race bug"

livekit-ffi/src/server/participant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ async fn forward_rpc_method_invocation(
140140
let (tx, rx) = oneshot::channel();
141141
let invocation_id = server.next_id();
142142

143+
room.store_rpc_method_invocation_waiter(invocation_id, tx);
144+
143145
let _ = server.send_event(proto::ffi_event::Message::RpcMethodInvocation(
144146
proto::RpcMethodInvocationEvent {
145147
local_participant_handle: local_participant_handle as u64,
@@ -152,8 +154,6 @@ async fn forward_rpc_method_invocation(
152154
},
153155
));
154156

155-
room.store_rpc_method_invocation_waiter(invocation_id, tx);
156-
157157
rx.await.unwrap_or_else(|_| {
158158
Err(RpcError {
159159
code: RpcErrorCode::ApplicationError as u32,

0 commit comments

Comments
 (0)