Skip to content

Commit 3a292e5

Browse files
feat: prefer configured port to be used for ipv4
and use a deterministic port for ipv6
1 parent 10782be commit 3a292e5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/hp/magicsock/conn.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2824,7 +2824,8 @@ fn new_re_stun_timer() -> time::Interval {
28242824

28252825
/// Initial connection setup.
28262826
async fn bind(port: u16) -> Result<(RebindingUdpConn, Option<RebindingUdpConn>)> {
2827-
let pconn6 = match RebindingUdpConn::bind(port, Network::Ipv6).await {
2827+
let ip6_port = if port != 0 { port + 1 } else { 0 };
2828+
let pconn6 = match RebindingUdpConn::bind(ip6_port, Network::Ipv6).await {
28282829
Ok(conn) => Some(conn),
28292830
Err(err) => {
28302831
info!("rebind ignoring IPv6 bind failure: {:?}", err);

0 commit comments

Comments
 (0)