-
-
Notifications
You must be signed in to change notification settings - Fork 447
update call to DataChannel::accept as per data pr #14 #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update call to DataChannel::accept as per data pr #14 #219
Conversation
| let mut existing_data_channels = Vec::new(); | ||
| for dc in dcs.iter() { | ||
| if let Some(dc) = dc.data_channel.lock().await.clone() { | ||
| let dc2 = dc.as_ref().clone(); |
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.
why the second clone? if it's an already cloned object
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.
Yeah, good question! The clone() should be to_owned() instead.
| async fn accept_data_channels(param: AcceptDataChannelParams) { | ||
| let dcs = param.data_channels.lock().await; | ||
| let mut existing_data_channels = Vec::new(); | ||
| for dc in dcs.iter() { |
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.
Also one idea I just had is to modify DataChannel::accept to accept a reference to a list of existing data channels. That way we won't need to clone all of them, just the one with matching identifier.
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.
👍 will make a PR to update there.
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.
Opened webrtc-rs/data#15
Allows for acceptance of already created data channels. Duplicates logic already existing in pion at https://github.com/pion/webrtc/blob/master/sctptransport.go#L162. Refs webrtc-rs/data#14 Replaces webrtc-rs#219 Co-authored-by: stuqdog <ethanrodkin@protonmail.com>
* update call to DataChannel::accept as per data pr #14 Allows for acceptance of already created data channels. Duplicates logic already existing in pion at https://github.com/pion/webrtc/blob/master/sctptransport.go#L162. Refs webrtc-rs/data#14 Replaces #219 Co-authored-by: stuqdog <ethanrodkin@protonmail.com> * bump data and sctp crates versions Co-authored-by: stuqdog <ethanrodkin@protonmail.com>
Allows for acceptance of already created data channels. Duplicates logic already existing in pion at https://github.com/pion/webrtc/blob/master/sctptransport.go#L162.
Note that this is a sibling(niece?) pr of webrtc-rs/data#14; it relies on that pr and won't compile until that pr is merged.