From: Martin Pitt Date: Fri, 16 Sep 2022 08:56:43 +0000 (+0200) Subject: tokio-tutorial-jbarszczewski: Handle each connection in separate task X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=fa249a206c8c9a806195ce98471e0433b20b49e7;p=learn-rust.git tokio-tutorial-jbarszczewski: Handle each connection in separate task --- diff --git a/tokio-tutorial-jbarszczewski/src/main.rs b/tokio-tutorial-jbarszczewski/src/main.rs index 5d49be5..e1c7800 100644 --- a/tokio-tutorial-jbarszczewski/src/main.rs +++ b/tokio-tutorial-jbarszczewski/src/main.rs @@ -7,7 +7,7 @@ async fn main() { loop { let (stream, _) = listener.accept().await.unwrap(); - handle_connection(stream).await; + tokio::spawn(async move { handle_connection(stream).await }); } }