Tweak tokio worker pool, only start with main server
This commit is contained in:
parent
2c5a76f92a
commit
2f3ea381b8
@ -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.
|
||||
|
11
src/main.rs
11
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)
|
||||
}
|
||||
|
@ -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<Config>) -> Result<(), ()> {
|
||||
// Load server state
|
||||
let server = Arc::new(Server::default());
|
||||
|
Loading…
x
Reference in New Issue
Block a user