Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/libstd/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,11 +883,23 @@ mod tests {

#[test]
fn set_nonblocking() {
let addr = next_test_ip4();
each_ip(&mut |addr, _| {
let socket = t!(UdpSocket::bind(&addr));

let stream = t!(UdpSocket::bind(&addr));
t!(socket.set_nonblocking(true));
t!(socket.set_nonblocking(false));

t!(socket.connect(addr));

t!(stream.set_nonblocking(true));
t!(stream.set_nonblocking(false));
t!(socket.set_nonblocking(false));
t!(socket.set_nonblocking(true));

let mut buf = [0];
match socket.recv(&mut buf) {
Ok(_) => panic!("expected error"),
Err(ref e) if e.kind() == ErrorKind::WouldBlock => {}
Err(e) => panic!("unexpected error {}", e),
}
})
}
}