mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-29 00:00:11 +02:00
Remove &addr arg from TcpListener::from_std (#92)
This has been deprecated in mio.
This commit is contained in:
committed by
Alex Crichton
parent
fd37fb0f17
commit
117dcba8cb
@@ -37,3 +37,6 @@ serde = "1.0"
|
|||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
time = "0.1"
|
time = "0.1"
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
mio = { git = "https://github.com/carllerche/mio" }
|
||||||
|
|||||||
+1
-2
@@ -119,9 +119,8 @@ impl TcpListener {
|
|||||||
/// `addr` is an IPv4 address then all sockets accepted will be IPv4 as
|
/// `addr` is an IPv4 address then all sockets accepted will be IPv4 as
|
||||||
/// well (same for IPv6).
|
/// well (same for IPv6).
|
||||||
pub fn from_std(listener: net::TcpListener,
|
pub fn from_std(listener: net::TcpListener,
|
||||||
addr: &SocketAddr,
|
|
||||||
handle: &Handle) -> io::Result<TcpListener> {
|
handle: &Handle) -> io::Result<TcpListener> {
|
||||||
let l = mio::net::TcpListener::from_listener(listener, addr)?;
|
let l = mio::net::TcpListener::from_std(listener)?;
|
||||||
TcpListener::new(l, handle)
|
TcpListener::new(l, handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -15,8 +15,7 @@ fn tcp_doesnt_block() {
|
|||||||
let core = Reactor::new().unwrap();
|
let core = Reactor::new().unwrap();
|
||||||
let handle = core.handle();
|
let handle = core.handle();
|
||||||
let listener = net::TcpListener::bind("127.0.0.1:0").unwrap();
|
let listener = net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||||
let addr = listener.local_addr().unwrap();
|
let listener = TcpListener::from_std(listener, &handle).unwrap();
|
||||||
let listener = TcpListener::from_std(listener, &addr, &handle).unwrap();
|
|
||||||
drop(core);
|
drop(core);
|
||||||
assert!(listener.incoming().wait().next().unwrap().is_err());
|
assert!(listener.incoming().wait().next().unwrap().is_err());
|
||||||
}
|
}
|
||||||
@@ -26,8 +25,7 @@ fn drop_wakes() {
|
|||||||
let core = Reactor::new().unwrap();
|
let core = Reactor::new().unwrap();
|
||||||
let handle = core.handle();
|
let handle = core.handle();
|
||||||
let listener = net::TcpListener::bind("127.0.0.1:0").unwrap();
|
let listener = net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||||
let addr = listener.local_addr().unwrap();
|
let listener = TcpListener::from_std(listener, &handle).unwrap();
|
||||||
let listener = TcpListener::from_std(listener, &addr, &handle).unwrap();
|
|
||||||
let (tx, rx) = oneshot::channel::<()>();
|
let (tx, rx) = oneshot::channel::<()>();
|
||||||
let t = thread::spawn(move || {
|
let t = thread::spawn(move || {
|
||||||
let incoming = listener.incoming();
|
let incoming = listener.incoming();
|
||||||
|
|||||||
Reference in New Issue
Block a user