Skip to content

Commit

Permalink
fix: avoid panic of graceful shutdown for finished connection
Browse files Browse the repository at this point in the history
fixes #3615
  • Loading branch information
DDtKey committed Mar 30, 2024
1 parent bc9a86f commit 104ad13
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server/conn/http1.rs
Expand Up @@ -482,7 +482,11 @@ where
/// This `Connection` should continue to be polled until shutdown
/// can finish.
pub fn graceful_shutdown(mut self: Pin<&mut Self>) {
Pin::new(self.inner.as_mut().unwrap()).graceful_shutdown()
// Connection (`inner`) is `None` if `poll` is `Ready`.
// In that case, we don't need to call `graceful_shutdown`.
if let Some(conn) = self.inner.as_mut() {
Pin::new(conn).graceful_shutdown()
}
}
}

Expand Down

0 comments on commit 104ad13

Please sign in to comment.