[dep-upgrade-202402] fix shutdown issue introduced when upgrading hyper

This commit is contained in:
Alex Auvolat
2024-02-08 23:43:59 +01:00
parent bcbd15da84
commit 5c63193d1d
6 changed files with 71 additions and 60 deletions
+6 -6
View File
@@ -2,7 +2,8 @@ use std::fs::{self, Permissions};
use std::os::unix::prelude::PermissionsExt;
use std::{convert::Infallible, sync::Arc};
use futures::future::Future;
use tokio::net::{TcpListener, UnixListener};
use tokio::sync::watch;
use hyper::{
body::Incoming as IncomingBody,
@@ -10,8 +11,6 @@ use hyper::{
Method, Request, Response, StatusCode,
};
use tokio::net::{TcpListener, UnixListener};
use opentelemetry::{
global,
metrics::{Counter, ValueRecorder},
@@ -84,8 +83,9 @@ impl WebServer {
pub async fn run(
self: Arc<Self>,
bind_addr: UnixOrTCPSocketAddress,
shutdown_signal: impl Future<Output = ()>,
must_exit: watch::Receiver<bool>,
) -> Result<(), GarageError> {
let server_name = "Web".into();
info!("Web server listening on {}", bind_addr);
match bind_addr {
@@ -94,7 +94,7 @@ impl WebServer {
let handler =
move |stream, socketaddr| self.clone().handle_request(stream, socketaddr);
server_loop(listener, handler, shutdown_signal).await
server_loop(server_name, listener, handler, must_exit).await
}
UnixOrTCPSocketAddress::UnixSocket(ref path) => {
if path.exists() {
@@ -108,7 +108,7 @@ impl WebServer {
let handler =
move |stream, socketaddr| self.clone().handle_request(stream, socketaddr);
server_loop(listener, handler, shutdown_signal).await
server_loop(server_name, listener, handler, must_exit).await
}
}
}