Skip to content

Commit

Permalink
fwd error
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom committed Dec 21, 2023
1 parent a4894f8 commit 4525c18
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions livekit-ffi/src/server/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ impl RoomInner {
let destination_sids = publish.destination_sids;
let async_id = server.next_id();

// Ignore result, if the channel is closed, it means the room has been closed
let _ = self.data_tx.send(FfiDataPacket {
if let Err(err) = self.data_tx.send(FfiDataPacket {
payload: DataPacket {
payload: data.to_vec(), // Avoid copy?
kind: kind.into(),
Expand All @@ -217,7 +216,18 @@ impl RoomInner {
.collect(),
},
async_id,
});
}) {
server.async_runtime.spawn(async move {
let cb = proto::PublishDataCallback {
async_id,
error: Some(err.to_string()),
};

let _ = server
.send_event(proto::ffi_event::Message::PublishData(cb))
.await;
});
}

Ok(proto::PublishDataResponse { async_id })
}
Expand Down

0 comments on commit 4525c18

Please sign in to comment.