diff options
author | Alex <alex@adnab.me> | 2024-02-09 09:32:54 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2024-02-09 09:32:54 +0000 |
commit | e4a43bfd592c149af8e3eac58ab317a518f0968a (patch) | |
tree | cf34b848df170b3e3289754c77c4a9f61b97a260 /src/web | |
parent | 8061bf5e1c250ff9234894f7a63910fedef1357b (diff) | |
parent | 5c63193d1de909cdecc501b482f5dc269a84874d (diff) | |
download | garage-e4a43bfd592c149af8e3eac58ab317a518f0968a.tar.gz garage-e4a43bfd592c149af8e3eac58ab317a518f0968a.zip |
Merge pull request 'Upgrade toml, kube, k8s-openapi + code fixes' (#709) from dep-upgrade-202402 into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/709
Diffstat (limited to 'src/web')
-rw-r--r-- | src/web/web_server.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/web/web_server.rs b/src/web/web_server.rs index 766e3829..269f37f2 100644 --- a/src/web/web_server.rs +++ b/src/web/web_server.rs @@ -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 } } } |