Fix TCP poll_hup test (#1106)

This updates tests to track a fix applied in Mio. Previously, Mio
incorrectly fired HUP events. This was due to Mio mapping `RDHUP` to
HUP. The test is updated to correctly generate a HUP event.

Additionally, HUP events will be removed from all platforms except for
Linux. This is caused by the inability to reliably map kqueue events to
the epoll HUP behavior.
This commit is contained in:
Carl Lerche
2019-05-24 14:08:07 -07:00
committed by GitHub
parent b2c53987d9
commit 1b498e8aa2
3 changed files with 8 additions and 2 deletions
+3
View File
@@ -8,6 +8,9 @@ jobs:
parameters:
rust_version: stable
- script: sudo apt-get update
displayName: "apt-get update"
- script: sudo apt-get install gcc-multilib
displayName: "Install gcc-multilib"
+1
View File
@@ -31,4 +31,5 @@ futures = "0.1.19"
[dev-dependencies]
env_logger = { version = "0.5", default-features = false }
net2 = "*"
tokio = { version = "0.2.0", path = "../tokio" }
+4 -2
View File
@@ -80,13 +80,14 @@ fn accept2() {
t.join().unwrap();
}
#[cfg(unix)]
mod unix {
#[cfg(target_os = "linux")]
mod linux {
use tokio_tcp::TcpStream;
use env_logger;
use futures::{future, Future};
use mio::unix::UnixReady;
use net2::TcpStreamExt;
use tokio_io::AsyncRead;
use std::io::Write;
@@ -101,6 +102,7 @@ mod unix {
let addr = t!(srv.local_addr());
let t = thread::spawn(move || {
let mut client = t!(srv.accept()).0;
client.set_linger(Some(Duration::from_millis(0))).unwrap();
client.write(b"hello world").unwrap();
thread::sleep(Duration::from_millis(200));
});