diff options
author | metamuffin <metamuffin@disroot.org> | 2023-02-12 14:55:27 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-02-12 14:55:27 +0100 |
commit | ca2fc2f2f173c95b96dfc87c9dcd0804fb597e00 (patch) | |
tree | 428ede5e2fd8f46e3e298b570280fc02d876b5d3 | |
parent | 15a806085ecfab0ced623e918aceedc3d5badbb5 (diff) | |
download | gnix-ca2fc2f2f173c95b96dfc87c9dcd0804fb597e00.tar gnix-ca2fc2f2f173c95b96dfc87c9dcd0804fb597e00.tar.bz2 gnix-ca2fc2f2f173c95b96dfc87c9dcd0804fb597e00.tar.zst |
fixed early exit when only one listerner was enabled
-rw-r--r-- | src/main.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index eb91b05..38fae53 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,7 @@ use std::{fs::File, io::BufReader, net::SocketAddr, path::Path, sync::Arc}; use tokio::{ io::{AsyncRead, AsyncWrite}, net::{TcpListener, TcpStream}, + signal::ctrl_c, }; use tokio_rustls::TlsAcceptor; @@ -42,10 +43,9 @@ async fn main() -> anyhow::Result<()> { ))?; let config = Arc::new(Config::load(&config_path)?); - tokio::select! { - x = serve_http(config.clone()) => x.context("serving http")?, - x = serve_https(config.clone()) => x.context("serving https")?, - }; + tokio::spawn(serve_http(config.clone())); + tokio::spawn(serve_https(config.clone())); + ctrl_c().await.unwrap(); Ok(()) } |