-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow config of pion udp ephemeral port range (#55)
* allow config of pion udp ephemeral port range * fix thread-unsafe global set/get * generalize init config so it will work with other backends * add limit-ports test and fix init race condition * faster limit-ports test
- Loading branch information
Showing
11 changed files
with
228 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#[tokio::test(flavor = "multi_thread")] | ||
async fn limit_ports() { | ||
tx5_core::Tx5InitConfig { | ||
ephemeral_udp_port_min: 40000, | ||
ephemeral_udp_port_max: 40000, | ||
} | ||
.set_as_global_default() | ||
.unwrap(); | ||
|
||
let (s, mut r) = tokio::sync::mpsc::unbounded_channel(); | ||
|
||
let mut con = tx5_go_pion::PeerConnection::new( | ||
tx5_go_pion::PeerConnectionConfig::default(), | ||
move |evt| { | ||
let _ = s.send(evt); | ||
}, | ||
) | ||
.await | ||
.unwrap(); | ||
|
||
let _dc = con | ||
.create_data_channel(tx5_go_pion::DataChannelConfig::default()) | ||
.await | ||
.unwrap(); | ||
let offer = con | ||
.create_offer(tx5_go_pion::OfferConfig::default()) | ||
.await | ||
.unwrap(); | ||
con.set_local_description(offer).await.unwrap(); | ||
|
||
tokio::time::timeout(std::time::Duration::from_secs(10), async { | ||
while let Some(evt) = r.recv().await { | ||
if let tx5_go_pion::PeerConnectionEvent::ICECandidate(mut ice) = evt | ||
{ | ||
let ice = ice.to_vec().unwrap(); | ||
let ice = String::from_utf8_lossy(&ice); | ||
let ice = ice.split(' ').collect::<Vec<_>>(); | ||
assert_eq!("40000", ice[5]); | ||
break; | ||
} | ||
} | ||
}) | ||
.await | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters