Skip to content

Commit

Permalink
tcp_reset_close_event: work around flake
Browse files Browse the repository at this point in the history
  • Loading branch information
goffrie authored and Thomasdezeeuw committed May 20, 2020
1 parent 6ac72bb commit 68805cb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/tcp_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::net::{self, Shutdown, SocketAddr};
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd};
use std::sync::{mpsc::channel, Arc, Barrier};
use std::thread;
use std::time::Duration;

#[macro_use]
mod util;
Expand Down Expand Up @@ -641,7 +642,14 @@ fn tcp_reset_close_event() {
vec![ExpectEvent::new(ID1, Readiness::READ_CLOSED)],
);

expect_no_events(&mut poll, &mut events);
// Make sure we quiesce. `expect_no_events` seems to flake sometimes on mac/freebsd.
loop {
poll.poll(&mut events, Some(Duration::from_millis(100)))
.expect("poll failed");
if events.iter().count() == 0 {
break;
}
}
}

#[test]
Expand Down

0 comments on commit 68805cb

Please sign in to comment.