Skip to content

Commit ef77ca7

Browse files
committed
Merge pull request #19859 from alexcrichton/flaky-test
std: Bind port early to make a test more reliable Reviewed-by: huonw
2 parents 4869794 + 0d38cae commit ef77ca7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libstd/io/net/udp.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,11 +557,12 @@ mod test {
557557
let addr1 = next_test_ip4();
558558
let addr2 = next_test_ip4();
559559
let mut a = UdpSocket::bind(addr1).unwrap();
560+
let a2 = UdpSocket::bind(addr2).unwrap();
560561

561562
let (tx, rx) = channel();
562563
let (tx2, rx2) = channel();
563564
spawn(move|| {
564-
let mut a = UdpSocket::bind(addr2).unwrap();
565+
let mut a = a2;
565566
assert_eq!(a.recv_from(&mut [0]), Ok((1, addr1)));
566567
assert_eq!(a.send_to(&[0], addr1), Ok(()));
567568
rx.recv();

0 commit comments

Comments
 (0)