File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -129,8 +129,11 @@ const MAX_CONNECTIONS: usize = 250;
129
129
/// `tokio::signal::ctrl_c()` can be used as the `shutdown` argument. This will
130
130
/// listen for a SIGINT signal.
131
131
pub async fn run ( listener : TcpListener , shutdown : impl Future ) -> crate :: Result < ( ) > {
132
- // A broadcast channel is used to signal shutdown to each of the active
133
- // connections. When the provided `shutdown` future completes
132
+ // When the provided `shutdown` future completes, we must send a shutdown
133
+ // message to all active connections. We use a broadcast channel for this
134
+ // purpose. The call below ignores the receiver of the broadcast pair, and when
135
+ // a receiver is needed, the subscribe() method on the sender is used to create
136
+ // one.
134
137
let ( notify_shutdown, _) = broadcast:: channel ( 1 ) ;
135
138
let ( shutdown_complete_tx, shutdown_complete_rx) = mpsc:: channel ( 1 ) ;
136
139
You can’t perform that action at this time.
0 commit comments