From 5ab323e5c2cb76c49a3ec8b6d5857b03ebdf28be Mon Sep 17 00:00:00 2001 From: David Renshaw Date: Sat, 20 Aug 2016 16:22:54 -0400 Subject: [PATCH] Revert to using futures::lazy(), which is in fact needed. --- src/bin/echo.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/echo.rs b/src/bin/echo.rs index f8b412f70..ccd947522 100644 --- a/src/bin/echo.rs +++ b/src/bin/echo.rs @@ -31,8 +31,9 @@ fn main() { // We use the `io::copy` future to copy all data from the // reading half onto the writing half. socket.incoming().for_each(|(socket, addr)| { - let (reader, writer) = TaskIo::new(socket).split(); - let amt = copy(reader, writer); + let socket = futures::lazy(|| futures::finished(TaskIo::new(socket))); + let pair = socket.map(|s| s.split()); + let amt = pair.and_then(|(reader, writer)| copy(reader, writer)); // Once all that is done we print out how much we wrote, and then // critically we *forget* this future which allows it to run