-
Notifications
You must be signed in to change notification settings - Fork 14
Conversation
while let Ok(signal) = socket_rx.recv_async().await { | ||
match signal { | ||
SocketMessage { event, uuid: id, data: sdp } if event == "offer" => { | ||
println!("\nReceiving offer: {:?}, for uuid: {:?}\n", sdp, id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use log::info
or so for these, no println
s
uuid: id.to_owned(), | ||
tx: socket_tx.clone(), | ||
sdp | ||
}).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect
instead of unwrap
if we don't think this can happen. Alternatively if the receiver is gone should this task halt?
for (_k, p) in &peers { | ||
match p.local_video_tracks.get(&uuid) { | ||
Some(track) => { | ||
if let Err(err) = track.write_rtp(&packet).await { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These futures can be created, collected into a Vec
and then ran concurrently with futures::join_all
|
||
async fn simple_file_send(filename: &str) -> Result<Response<Body>, anyhow::Error> { | ||
// Serve a file by asynchronously reading it by chunks using tokio-util crate. | ||
if let Ok(file) = tokio::fs::File::open(filename).await { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If filename
is user controlled this can trigger a path traversal vulnerability.
We have migrated this crate to the monorepo(webrtc-rs/webrtc) please re-open this pull request over there or perhaps for this case in the SFU repo? |
This branch adds a simple example of a Selective Forwarding Unit.
There's a little bit of cleanup I'll add shortly, but the big elephant in the room is this branch only works on the
main
branch ofwebrtc-rs
. I've set it as such here so that people can try it out by just pulling this branch, but ultimately we can't merge this until there's a new release, at which point we can tag the whole examples version to 0.5.