Skip to content

Commit

Permalink
Fix for issue tokio-rs#1117, temporary fix for set_ttl test on Window…
Browse files Browse the repository at this point in the history
…s, this test was crashing on Windows because, on Windows calling setsockopt on a

not connected socket is undefined behavior. More details can be found in issue tokio-rs#1117.

Signed-off-by: Daniel Tacalau <dst4096@gmail.com>
  • Loading branch information
dtacalau committed Nov 4, 2019
1 parent 162cdd3 commit c5a25a5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/tcp_stream.rs
Expand Up @@ -166,13 +166,23 @@ fn try_clone() {

#[test]
fn ttl() {
init();
let (mut poll, mut events) = init_with_poll();

let barrier = Arc::new(Barrier::new(2));
let (thread_handle, address) = start_listener(1, Some(barrier.clone()));

let stream = TcpStream::connect(address).unwrap();

poll.registry()
.register(&stream, ID1, Interests::WRITABLE)
.expect("unable to register TCP stream");

expect_events(
&mut poll,
&mut events,
vec![ExpectEvent::new(ID1, Interests::WRITABLE)],
);

const TTL: u32 = 10;
stream.set_ttl(TTL).unwrap();
assert_eq!(stream.ttl().unwrap(), TTL);
Expand Down

0 comments on commit c5a25a5

Please sign in to comment.