From 0991ee25b240a2b9bee40d7dab3c27de2859ef32 Mon Sep 17 00:00:00 2001 From: Evan Cameron Date: Thu, 11 Jun 2020 16:43:24 -0400 Subject: [PATCH] Add explicit notify_sender drop (#45) --- src/server.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server.rs b/src/server.rs index 5c36c45..88a6dd8 100644 --- a/src/server.rs +++ b/src/server.rs @@ -190,9 +190,13 @@ pub async fn run(listener: TcpListener, shutdown: impl Future) -> crate::Result< let Listener { mut shutdown_complete_rx, shutdown_complete_tx, + notify_shutdown, .. } = server; - + // When `notify_shutdown` is dropped, all tasks which have `subscribe`d will + // receive the shutdown signal and can exit + drop(notify_shutdown); + // Drop final `Sender` so the `Receiver` below can complete drop(shutdown_complete_tx); // Wait for all active connections to finish processing. As the `Sender`