diff --git a/Cargo.toml b/Cargo.toml index bc0c03bab..82dc8f83c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,8 +22,8 @@ dtls = { package = "webrtc-dtls", version = "0.5.2" } rtp = "0.6.5" rtcp = "0.6.5" srtp = { package = "webrtc-srtp", version = "0.8.9" } -sctp = { package = "webrtc-sctp", version = "0.4.3" } -data = { package = "webrtc-data", version = "0.3.3" } +sctp = { package = "webrtc-sctp", version = "0.5.0" } +data = { package = "webrtc-data", version = "0.4.0" } media = { package = "webrtc-media", version = "0.4.5" } interceptor = "0.7.6" tokio = { version = "1.19", features = ["full"] } diff --git a/src/sctp_transport/mod.rs b/src/sctp_transport/mod.rs index 245a95504..6f5d13172 100644 --- a/src/sctp_transport/mod.rs +++ b/src/sctp_transport/mod.rs @@ -212,12 +212,22 @@ impl RTCSctpTransport { } 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() { + if let Some(dc) = dc.data_channel.lock().await.clone() { + existing_data_channels.push(dc); + } + } + drop(dcs); + loop { let dc = tokio::select! { _ = param.notify_rx.notified() => break, result = DataChannel::accept( ¶m.sctp_association, data::data_channel::Config::default(), + &existing_data_channels, ) => { match result { Ok(dc) => dc,