From 5d5045d698bff7248eb5d9210675001de6fcc0fd Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Mon, 18 Dec 2017 16:53:45 -0800 Subject: [PATCH] chore(windows): poll core again to drop window socket --- tests/server.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/server.rs b/tests/server.rs index e400db68..e0435159 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -11,7 +11,7 @@ use futures::future::{self, FutureResult, Either}; use futures::sync::oneshot; use tokio_core::net::TcpListener; -use tokio_core::reactor::Core; +use tokio_core::reactor::{Core, Timeout}; use tokio_io::{AsyncRead, AsyncWrite}; use std::net::{TcpStream, SocketAddr}; @@ -658,6 +658,12 @@ fn disable_keep_alive_post_request() { assert!(!dropped.load()); core.run(fut).unwrap(); + // we must poll the Core one more time in order for Windows to drop + // the read-blocked socket. + // + // See https://github.com/carllerche/mio/issues/776 + let timeout = Timeout::new(Duration::from_millis(10), &core.handle()).unwrap(); + core.run(timeout).unwrap(); assert!(dropped.load()); child.join().unwrap(); }