Skip to content

Commit

Permalink
Rust done
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Oct 19, 2023
1 parent 1e46e35 commit 77dff05
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
1 change: 1 addition & 0 deletions rust/src/fbs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Flatbuffers data structures compiled from `.fbs` files
pub use root::fbs::*;

const _: () = ::planus::check_version_compatibility("planus-0.4.0");
Expand Down
25 changes: 13 additions & 12 deletions rust/src/router/webrtc_transport/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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)
);
}
Expand Down
1 change: 0 additions & 1 deletion rust/tests/integration/webrtc_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions worker/src/RTC/WebRtcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,6 @@ namespace RTC
std::vector<RTC::IceCandidate> 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)
Expand Down

0 comments on commit 77dff05

Please sign in to comment.