Skip to content

Commit

Permalink
remove empty callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
bcherry committed Oct 23, 2024
1 parent 865cdcf commit c139217
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 68 deletions.
6 changes: 2 additions & 4 deletions livekit-ffi/protocol/ffi.proto
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,8 @@ message FfiEvent {
PublishSipDtmfCallback publish_sip_dtmf = 21;
SendChatMessageCallback chat_message = 22;
PerformRpcCallback perform_rpc = 23;
RegisterRpcMethodCallback register_rpc_method = 24;
UnregisterRpcMethodCallback unregister_rpc_method = 25;
RpcMethodInvocationEvent rpc_method_invocation = 26;
RpcMethodInvocationResponseCallback rpc_method_invocation_response = 27;
RpcMethodInvocationEvent rpc_method_invocation = 24;
RpcMethodInvocationResponseCallback rpc_method_invocation_response = 25;
}
}

Expand Down
8 changes: 0 additions & 8 deletions livekit-ffi/protocol/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ message PerformRpcCallback {
optional RpcError error = 3;
}

message RegisterRpcMethodCallback {
required uint64 async_id = 1;
}

message UnregisterRpcMethodCallback {
required uint64 async_id = 1;
}

message RpcMethodInvocationResponseCallback {
required uint64 async_id = 1;
optional string error = 2;
Expand Down
20 changes: 2 additions & 18 deletions livekit-ffi/src/livekit.proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3642,18 +3642,6 @@ pub struct PerformRpcCallback {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RegisterRpcMethodCallback {
#[prost(uint64, required, tag="1")]
pub async_id: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnregisterRpcMethodCallback {
#[prost(uint64, required, tag="1")]
pub async_id: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RpcMethodInvocationResponseCallback {
#[prost(uint64, required, tag="1")]
pub async_id: u64,
Expand Down Expand Up @@ -3908,7 +3896,7 @@ pub mod ffi_response {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FfiEvent {
#[prost(oneof="ffi_event::Message", tags="1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27")]
#[prost(oneof="ffi_event::Message", tags="1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25")]
pub message: ::core::option::Option<ffi_event::Message>,
}
/// Nested message and enum types in `FfiEvent`.
Expand Down Expand Up @@ -3961,12 +3949,8 @@ pub mod ffi_event {
#[prost(message, tag="23")]
PerformRpc(super::PerformRpcCallback),
#[prost(message, tag="24")]
RegisterRpcMethod(super::RegisterRpcMethodCallback),
#[prost(message, tag="25")]
UnregisterRpcMethod(super::UnregisterRpcMethodCallback),
#[prost(message, tag="26")]
RpcMethodInvocation(super::RpcMethodInvocationEvent),
#[prost(message, tag="27")]
#[prost(message, tag="25")]
RpcMethodInvocationResponse(super::RpcMethodInvocationResponseCallback),
}
}
Expand Down
61 changes: 23 additions & 38 deletions livekit-ffi/src/server/participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,36 +92,28 @@ impl FfiParticipant {

let local_participant_handle = self.handle.clone();
let room: Arc<RoomInner> = self.room.clone();
let handle = server.async_runtime.spawn(async move {
local.register_rpc_method(
method.clone(),
move |request_id, caller_identity, payload, response_timeout| {
Box::pin({
let room = room.clone();
let method = method.clone();
async move {
forward_rpc_method_invocation(
server,
room,
local_participant_handle,
method,
request_id,
caller_identity,
payload,
response_timeout,
)
.await
}
})
},
);

let callback = proto::RegisterRpcMethodCallback { async_id };

let _ = server.send_event(proto::ffi_event::Message::RegisterRpcMethod(callback));
});

server.watch_panic(handle);
local.register_rpc_method(
method.clone(),
move |request_id, caller_identity, payload, response_timeout| {
Box::pin({
let room = room.clone();
let method = method.clone();
async move {
forward_rpc_method_invocation(
server,
room,
local_participant_handle,
method,
request_id,
caller_identity,
payload,
response_timeout,
)
.await
}
})
},
);
Ok(proto::RegisterRpcMethodResponse { async_id })
}

Expand All @@ -139,15 +131,8 @@ impl FfiParticipant {
}
};

let handle = server.async_runtime.spawn(async move {
local.unregister_rpc_method(request.method);
local.unregister_rpc_method(request.method);

let callback = proto::UnregisterRpcMethodCallback { async_id };

let _ = server.send_event(proto::ffi_event::Message::UnregisterRpcMethod(callback));
});

server.watch_panic(handle);
Ok(proto::UnregisterRpcMethodResponse { async_id })
}
}
Expand Down

0 comments on commit c139217

Please sign in to comment.