From 77dff05c497833c79295f8fb216f70289fe87be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Baz=20Castillo?= Date: Thu, 19 Oct 2023 20:03:54 +0200 Subject: [PATCH] Rust done --- rust/src/fbs.rs | 1 + rust/src/router/webrtc_transport/tests.rs | 25 +++++++++++----------- rust/tests/integration/webrtc_transport.rs | 1 - worker/src/RTC/WebRtcServer.cpp | 5 ----- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/rust/src/fbs.rs b/rust/src/fbs.rs index c27e5f0f8d..3f17e447b8 100644 --- a/rust/src/fbs.rs +++ b/rust/src/fbs.rs @@ -1,3 +1,4 @@ +//! Flatbuffers data structures compiled from `.fbs` files pub use root::fbs::*; const _: () = ::planus::check_version_compatibility("planus-0.4.0"); diff --git a/rust/src/router/webrtc_transport/tests.rs b/rust/src/router/webrtc_transport/tests.rs index 844555be4e..b26af13189 100644 --- a/rust/src/router/webrtc_transport/tests.rs +++ b/rust/src/router/webrtc_transport/tests.rs @@ -104,9 +104,15 @@ fn create_with_webrtc_server_succeeds() { }); let transport = router - .create_webrtc_transport(WebRtcTransportOptions::new_with_server( - webrtc_server.clone(), - )) + .create_webrtc_transport({ + let mut webrtc_transport_options = WebRtcTransportOptions::new_with_server( + webrtc_server.clone() + ); + // Let's disable UDP so resulting ICE candidates should only contain TCP. + webrtc_transport_options.enable_udp = false; + + webrtc_transport_options + }) .await .expect("Failed to create WebRTC transport"); @@ -124,18 +130,13 @@ fn create_with_webrtc_server_succeeds() { { let ice_candidates = transport.ice_candidates(); - assert_eq!(ice_candidates.len(), 2); + assert_eq!(ice_candidates.len(), 1); assert_eq!(ice_candidates[0].ip, IpAddr::V4(Ipv4Addr::LOCALHOST)); - assert_eq!(ice_candidates[0].protocol, Protocol::Udp); - assert_eq!(ice_candidates[0].port, port1); + assert_eq!(ice_candidates[0].protocol, Protocol::Tcp); + assert_eq!(ice_candidates[0].port, port2); assert_eq!(ice_candidates[0].r#type, IceCandidateType::Host); - assert_eq!(ice_candidates[0].tcp_type, None); - assert_eq!(ice_candidates[1].ip, IpAddr::V4(Ipv4Addr::LOCALHOST)); - assert_eq!(ice_candidates[1].protocol, Protocol::Tcp); - assert_eq!(ice_candidates[1].port, port2); - assert_eq!(ice_candidates[1].r#type, IceCandidateType::Host); assert_eq!( - ice_candidates[1].tcp_type, + ice_candidates[0].tcp_type, Some(IceCandidateTcpType::Passive) ); } diff --git a/rust/tests/integration/webrtc_transport.rs b/rust/tests/integration/webrtc_transport.rs index bf69f82a1d..e8c45b6761 100644 --- a/rust/tests/integration/webrtc_transport.rs +++ b/rust/tests/integration/webrtc_transport.rs @@ -161,7 +161,6 @@ fn create_succeeds() { .unwrap(), ); webrtc_transport_options.enable_sctp = true; - webrtc_transport_options.enable_udp = false; webrtc_transport_options.num_sctp_streams = NumSctpStreams { os: 2048, mis: 2048, diff --git a/worker/src/RTC/WebRtcServer.cpp b/worker/src/RTC/WebRtcServer.cpp index 78329633e9..8fe9f760a3 100644 --- a/worker/src/RTC/WebRtcServer.cpp +++ b/worker/src/RTC/WebRtcServer.cpp @@ -268,11 +268,6 @@ namespace RTC std::vector iceCandidates; uint16_t iceLocalPreferenceDecrement{ 0 }; - if (!enableUdp) - MS_DUMP_STD("---------------------- no enableUdp"); - else - MS_DUMP_STD("---------------------- YES enableUdp"); - for (auto& item : this->udpSocketOrTcpServers) { if (item.udpSocket && enableUdp)