]> piware.de Git - learn-rust.git/commitdiff
tokio-tutorial-jbarszczewski: Handle each connection in separate task
authorMartin Pitt <martin@piware.de>
Fri, 16 Sep 2022 08:56:43 +0000 (10:56 +0200)
committerMartin Pitt <martin@piware.de>
Fri, 16 Sep 2022 09:54:11 +0000 (11:54 +0200)
tokio-tutorial-jbarszczewski/src/main.rs

index 5d49be551efef52c54ac9d9e2a12fc52029e249e..e1c7800d242f5b87543562288221967a491d5208 100644 (file)
@@ -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 });
     }
 }