Skip to content

Commit

Permalink
Merge pull request #19859 from alexcrichton/flaky-test
Browse files Browse the repository at this point in the history
std: Bind port early to make a test more reliable

Reviewed-by: huonw
  • Loading branch information
bors committed Dec 16, 2014
2 parents 4208cb8 + 0d38cae commit 4163c6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libstd/io/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,12 @@ mod test {
let addr1 = next_test_ip4();
let addr2 = next_test_ip4();
let mut a = UdpSocket::bind(addr1).unwrap();
let a2 = UdpSocket::bind(addr2).unwrap();

let (tx, rx) = channel();
let (tx2, rx2) = channel();
spawn(move|| {
let mut a = UdpSocket::bind(addr2).unwrap();
let mut a = a2;
assert_eq!(a.recv_from(&mut [0]), Ok((1, addr1)));
assert_eq!(a.send_to(&[0], addr1), Ok(()));
rx.recv();
Expand Down

0 comments on commit 4163c6f

Please sign in to comment.