diff --git a/Cargo.toml b/Cargo.toml index 299799051..cef1c19ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ appveyor = { repository = "alexcrichton/tokio-core" } [dependencies] futures = "0.1.9" log = "0.3" -mio = "0.6" +mio = "0.6.4" scoped-tls = "0.1.0" slab = "0.3" diff --git a/src/net/tcp.rs b/src/net/tcp.rs index d2d2e4df5..8ff84a557 100644 --- a/src/net/tcp.rs +++ b/src/net/tcp.rs @@ -267,9 +267,15 @@ impl TcpStream { } /// Create a new `TcpStream` from a `net::TcpStream`. - pub fn from_stream(stream: net::TcpStream, handle: &Handle) -> io::Result { + /// + /// This function will convert a TCP stream in the standard library to a TCP + /// stream ready to be used with the provided event loop handle. The object + /// returned is associated with the event loop and ready to perform I/O. + pub fn from_stream(stream: net::TcpStream, handle: &Handle) + -> io::Result { + let inner = try!(mio::tcp::TcpStream::from_stream(stream)); Ok(TcpStream { - io: try!(PollEvented::new(try!(mio::tcp::TcpStream::from_stream(stream)), handle)), + io: try!(PollEvented::new(inner, handle)), }) }