diff --git a/Cargo.toml b/Cargo.toml index 1a05748..bf83a9f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,4 +6,3 @@ members = ["salut", "desec"] lto = "fat" opt-level = 3 strip = "symbols" -panic = "abort" diff --git a/salut/src/main.rs b/salut/src/main.rs index d0e9ac4..3c00126 100644 --- a/salut/src/main.rs +++ b/salut/src/main.rs @@ -48,13 +48,24 @@ async fn main() -> Result<(), anyhow::Error> { ); let cert_clone = certs.clone(); let host_clone = host.clone(); - tokio::spawn(async move { + let tls_handle = tokio::spawn(async move { server::listen_tls(host_clone, cfg.tls_port, cert_clone) .await .expect("TLS listener") }); - server::listen_starttls(host, cfg.insecure_port, certs) - .await - .expect("STARTTLS listener"); - Ok(()) + let starttls_handle = tokio::spawn(async move { + server::listen_starttls(host, cfg.insecure_port, certs) + .await + .expect("STARTTLS listener"); + }); + tokio::select! { + _ = tls_handle => { + error!("tls handler returned unexpectedly"); + }, + _ = starttls_handle => { + error!("starttls handler returned unexpectedly"); + }, + }; + + Err(anyhow::anyhow!("unexpected server shutdown")) }