diff --git a/src/action/start.rs b/src/action/start.rs index bc8bb5f..0bf192a 100644 --- a/src/action/start.rs +++ b/src/action/start.rs @@ -12,7 +12,7 @@ use crate::service; const RCON_PASSWORD_LENGTH: usize = 32; /// Start lazymc. -pub async fn invoke(matches: &ArgMatches) -> Result<(), ()> { +pub fn invoke(matches: &ArgMatches) -> Result<(), ()> { // Load config #[allow(unused_mut)] let mut config = config::load(matches); @@ -27,7 +27,7 @@ pub async fn invoke(matches: &ArgMatches) -> Result<(), ()> { // Start server service // TODO: start tokio runtime here? let config = Arc::new(config); - service::server::service(config).await + service::server::service(config) } /// Prepare RCON. diff --git a/src/main.rs b/src/main.rs index 64d4a4f..b9bb25b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,14 +29,13 @@ use clap::App; const LOG_DEFAULT: &str = "info"; /// Main entrypoint. -#[tokio::main] -async fn main() -> Result<(), ()> { +fn main() -> Result<(), ()> { // Initialize logger init_log(); // Build clap app, invoke intended action let app = cli::app(); - invoke_action(app).await + invoke_action(app) } /// Initialize logger. @@ -54,7 +53,7 @@ fn init_log() { } /// Invoke an action. -async fn invoke_action<'a>(app: App<'a>) -> Result<(), ()> { +fn invoke_action<'a>(app: App<'a>) -> Result<(), ()> { let matches = app.get_matches(); // Config operations @@ -69,9 +68,9 @@ async fn invoke_action<'a>(app: App<'a>) -> Result<(), ()> { return Ok(()); } - unimplemented!("Config logic here!"); + unreachable!(); } // Start server - action::start::invoke(&matches).await + action::start::invoke(&matches) } diff --git a/src/service/server.rs b/src/service/server.rs index fc9cb9f..4819814 100644 --- a/src/service/server.rs +++ b/src/service/server.rs @@ -13,6 +13,11 @@ use crate::status; use crate::util::error::{quit_error, ErrorHints}; /// Start lazymc. +/// +/// Main entrypoint to start all server/status/proxy logic. +/// +/// Spawns a tokio runtime to complete all work on. +#[tokio::main(flavor = "multi_thread")] pub async fn service(config: Arc) -> Result<(), ()> { // Load server state let server = Arc::new(Server::default());