From 6d9728023f0aab3b5826e8842a0be10ac29ac1d4 Mon Sep 17 00:00:00 2001 From: Cameron Bytheway Date: Mon, 9 Dec 2024 09:49:25 -0700 Subject: [PATCH] fix(s2n-quic-dc): resolve unspecified peer addrs on connect (#2408) --- dc/s2n-quic-dc/src/stream/client/tokio.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dc/s2n-quic-dc/src/stream/client/tokio.rs b/dc/s2n-quic-dc/src/stream/client/tokio.rs index d1c85c528..cd9a736b4 100644 --- a/dc/s2n-quic-dc/src/stream/client/tokio.rs +++ b/dc/s2n-quic-dc/src/stream/client/tokio.rs @@ -65,13 +65,21 @@ where // Make sure TCP_NODELAY is set let _ = socket.set_nodelay(true); + // if the acceptor_ip isn't known, then ask the socket to resolve it for us + let peer_addr = if acceptor_addr.ip().is_unspecified() { + socket.peer_addr()? + } else { + acceptor_addr + } + .into(); let local_port = socket.local_addr()?.port(); + let stream = endpoint::open_stream( env, peer, env::TcpRegistered { socket, - peer_addr: acceptor_addr.into(), + peer_addr, local_port, }, subscriber,