@@ -132,7 +132,7 @@ pub async fn run(listener: TcpListener, shutdown: impl Future) -> crate::Result<
132
132
// A broadcast channel is used to signal shutdown to each of the active
133
133
// connections. When the provided `shutdown` future completes
134
134
let ( notify_shutdown, _) = broadcast:: channel ( 1 ) ;
135
- let ( shutdown_complete_tx, shutdown_complete_rx) = mpsc:: channel ( 0 ) ;
135
+ let ( shutdown_complete_tx, shutdown_complete_rx) = mpsc:: channel ( 1 ) ;
136
136
137
137
// Initialize the listener state
138
138
let mut server = Listener {
@@ -181,10 +181,12 @@ pub async fn run(listener: TcpListener, shutdown: impl Future) -> crate::Result<
181
181
}
182
182
}
183
183
184
- // Extract the `shutdown_complete` receiver. By not mentioning
185
- // `shutdown_receiver` here, it is dropped . This is important, as the
184
+ // Extract the `shutdown_complete` receiver and transmitter
185
+ // ` explicitly drop shutdown_transmitter` . This is important, as the
186
186
// `.await` below would otherwise never complete.
187
- let Listener { mut shutdown_complete_rx, .. } = server;
187
+ let Listener { mut shutdown_complete_rx, shutdown_complete_tx, .. } = server;
188
+
189
+ drop ( shutdown_complete_tx) ;
188
190
189
191
// Wait for all active connections to finish processing. As the `Sender`
190
192
// handle held by the listener has been dropped above, the only remaining
0 commit comments