Add explicit notify_sender drop (#45)

This commit is contained in:
Evan Cameron
2020-06-11 16:43:24 -04:00
committed by GitHub
parent c0bcee4300
commit 0991ee25b2

View File

@@ -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`