Skip to content

Commit dd077d5

Browse files
committed
Auto merge of #22857 - alexcrichton:net-flaky, r=alexcrichton
Instead of allocating the same ports for ipv4 and ipv6 tests, instead draw all ports from the same pool. Some tests connect to just "localhost" on a particular port which may accidentally be interacting with other tests as the ipv-what-ness isn't specified with the string "localhost" Relevant logs: * [Deadlock of the `net::tcp::tests::listen_localhost` test][mac] * [Failure of the `fast_rebind` test][win1] * [Failure of `multiple_connect_interleaved_lazy_schedule_ip4`][win2] [mac]: https://gist.github.com/alexcrichton/349c7ce7c620c1adb2f2 [win1]: https://gist.github.com/alexcrichton/7e3611faae2e1edaee6f [win2]: https://gist.github.com/alexcrichton/4f5f87749af3ad0f9851
2 parents e5cd653 + c2400bb commit dd077d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libstd/net/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ use env;
1414
use net::{SocketAddr, IpAddr};
1515
use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
1616

17+
static PORT: AtomicUsize = ATOMIC_USIZE_INIT;
18+
1719
pub fn next_test_ip4() -> SocketAddr {
18-
static PORT: AtomicUsize = ATOMIC_USIZE_INIT;
1920
SocketAddr::new(IpAddr::new_v4(127, 0, 0, 1),
2021
PORT.fetch_add(1, Ordering::SeqCst) as u16 + base_port())
2122
}
2223

2324
pub fn next_test_ip6() -> SocketAddr {
24-
static PORT: AtomicUsize = ATOMIC_USIZE_INIT;
2525
SocketAddr::new(IpAddr::new_v6(0, 0, 0, 0, 0, 0, 0, 1),
2626
PORT.fetch_add(1, Ordering::SeqCst) as u16 + base_port())
2727
}

0 commit comments

Comments
 (0)