mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
Revert to using futures::lazy(), which is in fact needed.
This commit is contained in:
+3
-2
@@ -31,8 +31,9 @@ fn main() {
|
|||||||
// We use the `io::copy` future to copy all data from the
|
// We use the `io::copy` future to copy all data from the
|
||||||
// reading half onto the writing half.
|
// reading half onto the writing half.
|
||||||
socket.incoming().for_each(|(socket, addr)| {
|
socket.incoming().for_each(|(socket, addr)| {
|
||||||
let (reader, writer) = TaskIo::new(socket).split();
|
let socket = futures::lazy(|| futures::finished(TaskIo::new(socket)));
|
||||||
let amt = copy(reader, writer);
|
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
|
// Once all that is done we print out how much we wrote, and then
|
||||||
// critically we *forget* this future which allows it to run
|
// critically we *forget* this future which allows it to run
|
||||||
|
|||||||
Reference in New Issue
Block a user