mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-17 00:00:11 +02:00
Change net::Incoming signature to match std. (#89)
std's `Incoming` iterator yields `TcpStream` instances. This patch updates the `Incoming` future to match this signature. This changes the yielded value from `(TcpStream, SocketAddr)` -> `TcpStream`.
This commit is contained in:
committed by
Alex Crichton
parent
f4ec9a6360
commit
ae627db266
+1
-1
@@ -59,7 +59,7 @@
|
||||
//! .expect("unable to bind TCP listener");
|
||||
//!
|
||||
//! // Pull out a stream of sockets for incoming connections
|
||||
//! let server = listener.incoming().for_each(|(sock, _)| {
|
||||
//! let server = listener.incoming().for_each(|sock| {
|
||||
//! // Split up the reading and writing parts of the
|
||||
//! // socket.
|
||||
//! let (reader, writer) = sock.split();
|
||||
|
||||
+3
-2
@@ -182,11 +182,12 @@ impl fmt::Debug for TcpListener {
|
||||
}
|
||||
|
||||
impl Stream for Incoming {
|
||||
type Item = (TcpStream, SocketAddr);
|
||||
type Item = TcpStream;
|
||||
type Error = io::Error;
|
||||
|
||||
fn poll(&mut self) -> Poll<Option<Self::Item>, io::Error> {
|
||||
Ok(Async::Ready(Some(try_nb!(self.inner.accept()))))
|
||||
let (socket, _) = try_nb!(self.inner.accept());
|
||||
Ok(Async::Ready(Some(socket)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user