Skip to content

Commit 0991ee2

Browse files
authored
Add explicit notify_sender drop (#45)
1 parent c0bcee4 commit 0991ee2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/server.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,13 @@ pub async fn run(listener: TcpListener, shutdown: impl Future) -> crate::Result<
190190
let Listener {
191191
mut shutdown_complete_rx,
192192
shutdown_complete_tx,
193+
notify_shutdown,
193194
..
194195
} = server;
195-
196+
// When `notify_shutdown` is dropped, all tasks which have `subscribe`d will
197+
// receive the shutdown signal and can exit
198+
drop(notify_shutdown);
199+
// Drop final `Sender` so the `Receiver` below can complete
196200
drop(shutdown_complete_tx);
197201

198202
// Wait for all active connections to finish processing. As the `Sender`

0 commit comments

Comments
 (0)