From ffdaa7179bdfec95c7e3244fa760f5496996bd82 Mon Sep 17 00:00:00 2001 From: Leynos Date: Sun, 15 Jun 2025 15:26:06 +0100 Subject: [PATCH] Simplify connection handling --- src/server.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server.rs b/src/server.rs index e98c06c9..12cca0ef 100644 --- a/src/server.rs +++ b/src/server.rs @@ -393,10 +393,10 @@ async fn process_stream( } let stream = RewindStream::new(leftover, stream); // Hand the connection to the application for processing. + // We already run `process_stream` inside a task, so spawning again + // only adds overhead. let app = (factory)(); - tokio::spawn(async move { - app.handle_connection(stream).await; - }); + app.handle_connection(stream).await; } Err(err) => { if let Some(handler) = on_failure.as_ref() {