diff options
author | metamuffin <metamuffin@disroot.org> | 2023-02-24 20:22:13 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-02-24 20:22:13 +0100 |
commit | c3371bd7e3eb40fad374fe85a994806c2d27488e (patch) | |
tree | 0714ab45a44dc010b42f03ff003fda833277e82d | |
parent | 86ef22584a93f26c77c50b5d7e0a113b354749b9 (diff) | |
download | gnix-c3371bd7e3eb40fad374fe85a994806c2d27488e.tar gnix-c3371bd7e3eb40fad374fe85a994806c2d27488e.tar.bz2 gnix-c3371bd7e3eb40fad374fe85a994806c2d27488e.tar.zst |
panic when listening fails
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 3e912f9..422341d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,9 +38,19 @@ async fn main() -> anyhow::Result<()> { "first argument is expected to be the configuration file" ))?; let config = Arc::new(Config::load(&config_path)?); + let config2 = config.clone(); + + tokio::spawn(async move { + if let Err(e) = serve_http(config).await { + panic!("{e}") + } + }); + tokio::spawn(async move { + if let Err(e) = serve_https(config2).await { + panic!("{e}") + } + }); - tokio::spawn(serve_http(config.clone())); - tokio::spawn(serve_https(config.clone())); ctrl_c().await.unwrap(); Ok(()) } |