From 84e933f33c21166084bfccb8a218036564c0c14a Mon Sep 17 00:00:00 2001 From: ackingliu Date: Wed, 28 Oct 2026 16:03:26 +0800 Subject: [PATCH] test: switch overlapping SOCKS5 listeners on a port outside the ephemeral range overlapping_listen_addresses_on_one_port_can_be_switched took its port from 127.0.0.1:0 and then released and re-bound it while moving between 127.0.0.1 and 0.0.0.0. A parallel test binding :0 could be handed that just-released ephemeral port in between, failing the switch with EADDRINUSE (seen on ubuntu-latest in #59). Use restartable_address(), as 3a4a7bb did for the two restart tests. Co-Authored-By: Claude Opus 5.5 --- crates/proxy-server/tests/managed_socks5.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/proxy-server/tests/managed_socks5.rs b/crates/proxy-server/tests/managed_socks5.rs index 8bd8b21..d0b56d8 100644 --- a/crates/proxy-server/tests/managed_socks5.rs +++ b/crates/proxy-server/tests/managed_socks5.rs @@ -963,7 +963,10 @@ async fn failed_restore_keeps_management_available_and_can_retry() { async fn overlapping_listen_addresses_on_one_port_can_be_switched() { let dir = tempfile::tempdir().unwrap(); let server = Server::start(dir.path()).await; - let status = server.serve(WireProtocol::V3).await; + // Switching releases the port and binds it again (see `restartable_address`). + let status = server + .serve_at(restartable_address(), WireProtocol::V3) + .await; let port = status.config.listen.port(); let loopback = SocketAddr::from(([127, 0, 0, 1], port)); let moved = server