Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: graceful shutdown after switch to hyper
1.x
(#779)
For some reason it was removed after switch to `hyper 1.x` ([commit](0b6ca89)) <details> <summary> Patch affected the behavior </summary> ```patch - let mut conn = Http::new() - .serve_connection(socket, service) - .with_upgrades(); + let builder = auto::Builder::new(hyper_util::rt::TokioExecutor::new()); + let conn = + builder.serve_connection_with_upgrades(hyper_util::rt::TokioIo::new(socket), service); + futures_util::pin_mut!(conn); tokio::select! { - _ = &mut conn => { + _ = conn => { // Connection completed successfully. return; }, @@ -366,10 +368,4 @@ } _ = server_graceful_shutdown_token.cancelled() => {} } - - // Init graceful shutdown for connection (`GOAWAY` for `HTTP/2` or disabling `keep-alive` for `HTTP/1`) - Pin::new(&mut conn).graceful_shutdown(); - - // Continue awaiting after graceful-shutdown is initiated to handle existed requests. - let _ = conn.await; ``` </details>
- Loading branch information