From 30e51d60a852419aed25293ac179b56c5d401ab4 Mon Sep 17 00:00:00 2001 From: fokx <36614441+fokx@users.noreply.github.com> Date: Tue, 29 Apr 2025 20:52:07 +0800 Subject: [PATCH] fix example in graceful-shutdown.md: add `drop(listener)` Need to drop the listener for the graceful shutdown to fully succeed. Otherwise, even though we cannot `curl` the server addr, `netstat` still shows the process listening. This will align the example with the hyper-util example in: https://github.com/hyperium/hyper-util/blob/e74ab7888638e768de17c47ed5f20c8b623a308f/examples/server_graceful.rs#L47 --- _stable/server/graceful-shutdown.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_stable/server/graceful-shutdown.md b/_stable/server/graceful-shutdown.md index 3c67cfe..f38f092 100644 --- a/_stable/server/graceful-shutdown.md +++ b/_stable/server/graceful-shutdown.md @@ -88,6 +88,7 @@ loop { }, _ = &mut signal => { + drop(listener); eprintln!("graceful shutdown signal received"); // stop the accept loop break;