From 117dcba8cbff8fc5b688865360eb2c04277b09eb Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Tue, 30 Jan 2018 12:49:32 -0800 Subject: [PATCH] Remove &addr arg from TcpListener::from_std (#92) This has been deprecated in mio. --- Cargo.toml | 3 +++ src/net/tcp.rs | 3 +-- tests/drop-core.rs | 6 ++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d9741d8de..81f7e364c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,3 +37,6 @@ serde = "1.0" serde_derive = "1.0" serde_json = "1.0" time = "0.1" + +[patch.crates-io] +mio = { git = "https://github.com/carllerche/mio" } diff --git a/src/net/tcp.rs b/src/net/tcp.rs index 394f0651c..0861b7a64 100644 --- a/src/net/tcp.rs +++ b/src/net/tcp.rs @@ -119,9 +119,8 @@ impl TcpListener { /// `addr` is an IPv4 address then all sockets accepted will be IPv4 as /// well (same for IPv6). pub fn from_std(listener: net::TcpListener, - addr: &SocketAddr, handle: &Handle) -> io::Result { - let l = mio::net::TcpListener::from_listener(listener, addr)?; + let l = mio::net::TcpListener::from_std(listener)?; TcpListener::new(l, handle) } diff --git a/tests/drop-core.rs b/tests/drop-core.rs index 91be87181..75ac9b7eb 100644 --- a/tests/drop-core.rs +++ b/tests/drop-core.rs @@ -15,8 +15,7 @@ fn tcp_doesnt_block() { let core = Reactor::new().unwrap(); let handle = core.handle(); let listener = net::TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = listener.local_addr().unwrap(); - let listener = TcpListener::from_std(listener, &addr, &handle).unwrap(); + let listener = TcpListener::from_std(listener, &handle).unwrap(); drop(core); assert!(listener.incoming().wait().next().unwrap().is_err()); } @@ -26,8 +25,7 @@ fn drop_wakes() { let core = Reactor::new().unwrap(); let handle = core.handle(); let listener = net::TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = listener.local_addr().unwrap(); - let listener = TcpListener::from_std(listener, &addr, &handle).unwrap(); + let listener = TcpListener::from_std(listener, &handle).unwrap(); let (tx, rx) = oneshot::channel::<()>(); let t = thread::spawn(move || { let incoming = listener.incoming();