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:
Carl Lerche
2018-01-30 15:01:34 -06:00
committed by Alex Crichton
parent f4ec9a6360
commit ae627db266
18 changed files with 31 additions and 28 deletions
+3 -3
View File
@@ -48,7 +48,7 @@ fn main() {
println!("Listening on: {}", listen_addr);
println!("Proxying to: {}", server_addr);
let done = socket.incoming().for_each(move |(client, client_addr)| {
let done = socket.incoming().for_each(move |client| {
let server = TcpStream::connect(&server_addr);
let amounts = server.and_then(move |server| {
// Create separate read/write handles for the TCP clients that we're
@@ -82,8 +82,8 @@ fn main() {
});
let msg = amounts.map(move |(from_client, from_server)| {
println!("client at {} wrote {} bytes and received {} bytes",
client_addr, from_client, from_server);
println!("client wrote {} bytes and received {} bytes",
from_client, from_server);
}).map_err(|e| {
// Don't panic. Maybe the client just disconnected too soon.
println!("error: {}", e);