feat(server): add Server::with_graceful_shutdown method

This adds a "combinator" method to `Server`, which accepts a user's
future to "select" on. All connections received by the `Server` will
be tracked, and if the user's future finishes, graceful shutdown will
begin.

- The listener will be closed immediately.
- The currently active connections will all be notified to start a
  graceful shutdown. For HTTP/1, that means finishing the existing
  response and using `connection: clone`. For HTTP/2, the graceful
  `GOAWAY` process is started.
- Once all active connections have terminated, the graceful future
  will return.

Closes #1575
This commit is contained in:
Sean McArthur
2018-08-23 11:30:44 -07:00
committed by GitHub
parent a3c44ded55
commit 168c7d2155
5 changed files with 281 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
mod buf;
pub(crate) mod drain;
mod exec;
pub(crate) mod io;
mod lazy;