Skip to content

Commit

Permalink
fix(server): fix panic in Connection::graceful_shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Mar 25, 2020
1 parent 597cef2 commit fce3ddc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/server/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,21 @@ where
///
/// This `Connection` should continue to be polled until shutdown
/// can finish.
///
/// # Note
///
/// This should only be called while the `Connection` future is still
/// pending. If called after `Connection::poll` has resolved, this does
/// nothing.
pub fn graceful_shutdown(self: Pin<&mut Self>) {
match self.project().conn.as_mut().unwrap() {
ProtoServer::H1(ref mut h1) => {
match self.project().conn {
Some(ProtoServer::H1(ref mut h1)) => {
h1.disable_keep_alive();
}
ProtoServer::H2(ref mut h2) => {
Some(ProtoServer::H2(ref mut h2)) => {
h2.graceful_shutdown();
}
None => (),
}
}

Expand Down

0 comments on commit fce3ddc

Please sign in to comment.