Skip to content

Commit

Permalink
do not panic when sending close message
Browse files Browse the repository at this point in the history
  • Loading branch information
davepacheco committed Jun 30, 2023
1 parent 904d530 commit bcc097c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dropshot/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,11 @@ impl<C: ServerContext> HttpServer<C> {
impl Drop for CloseHandle {
fn drop(&mut self) {
if let Some(c) = self.close_channel.take() {
c.send(()).expect("failed to send close signal")
// The other side of this channel is owned by a separate tokio task
// that's running the hyper server. We do not expect that to be
// cancelled. But it can happen if the executor itself is shutting
// down and that task happens to get cleaned up before this one.
let _ = c.send(());
}
}
}
Expand Down

0 comments on commit bcc097c

Please sign in to comment.