From 50cadbee9624f1a24f2395ce28439d7140a433fa Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 2 Jan 2025 07:31:16 +0000 Subject: [PATCH] add faster shutdown point in unix socket listener Signed-off-by: Jason Volk --- src/router/serve/unix.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/router/serve/unix.rs b/src/router/serve/unix.rs index fcd361f0..6855b34c 100644 --- a/src/router/serve/unix.rs +++ b/src/router/serve/unix.rs @@ -106,7 +106,10 @@ async fn accepted( trace!(?socket, ?handler, "serving connection"); // bug on darwin causes all results to be errors. do not unwrap this - _ = builder.serve_connection(socket, handler).await; + tokio::select! { + () = server.until_shutdown() => (), + _ = builder.serve_connection(socket, handler) => (), + }; } async fn init(server: &Arc) -> Result {