From d0de94e57889b0dbb11975c3f66c55a7f3b320f5 Mon Sep 17 00:00:00 2001 From: "Tristan Poland (Trident_For_U)" <34868944+tristanpoland@users.noreply.github.com> Date: Fri, 20 Dec 2024 19:02:44 -0500 Subject: [PATCH 1/2] Update main.rs --- server/src/main.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index d6da634..86b8102 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -22,17 +22,20 @@ // Caznix // // License: Apache-2.0 // //=============================================================================// -static CTRL_C_HANDLER: Once = Once::new(); + use std::sync::Once; use once_cell::sync::Lazy; use server::{config::server_config, start}; use splash::splash; use anyhow::{Context, Result}; use horizon_logger::{HorizonLogger, log_info, log_debug, log_warn, log_error, log_critical}; + mod server; mod splash; mod collision; +static CTRL_C_HANDLER: Once = Once::new(); + //------------------------------------------------------------------------------ // Global Logger Configuration //------------------------------------------------------------------------------ @@ -50,14 +53,13 @@ async fn main() -> Result<()> { splash(); let config_init_time = std::time::Instant::now(); - //let server_config: std::sync::Arc = server_config().context("Failed to obtain server config")?; log_info!(LOGGER, "INIT", "Server config loaded in {:#?}", config_init_time.elapsed()); let init_time = std::time::Instant::now(); // Start the server server::start().await.context("Failed to start server")?; - + println!("Server started in {:#?}", init_time.elapsed()); let mut terminating: bool = false; @@ -71,9 +73,8 @@ async fn main() -> Result<()> { std::process::exit(0); } - }, - - ).expect("Failed to handle Ctrl+C"); + }) + .expect("Failed to handle Ctrl+C"); }); Ok(()) } From b7ac10de316682707181a6117025b81464d0451a Mon Sep 17 00:00:00 2001 From: "Tristan Poland (Trident_For_U)" <34868944+tristanpoland@users.noreply.github.com> Date: Sat, 21 Dec 2024 12:13:27 -0500 Subject: [PATCH 2/2] Update main.rs --- server/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main.rs b/server/src/main.rs index 86b8102..2970a63 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -74,7 +74,7 @@ async fn main() -> Result<()> { } }) - .expect("Failed to handle Ctrl+C"); + .expect("Failed to register ctrl+c handler"); }); Ok(()) }