Skip to content

Commit f65072a

Browse files
authored
fix example in graceful-shutdown.md: add drop(listener) (#148)
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
1 parent 76239b9 commit f65072a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

_stable/server/graceful-shutdown.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ loop {
8888
},
8989

9090
_ = &mut signal => {
91+
drop(listener);
9192
eprintln!("graceful shutdown signal received");
9293
// stop the accept loop
9394
break;

0 commit comments

Comments
 (0)