From 344f2916452d97a2c6a58ba7cbf1d88e036e0b9c Mon Sep 17 00:00:00 2001 From: Romira915 <40430090+Romira915@users.noreply.github.com> Date: Wed, 5 Apr 2023 17:01:09 +0000 Subject: [PATCH] fix --- homeserver_receive_process/src/main.rs | 42 ++++++++++++++++++-------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/homeserver_receive_process/src/main.rs b/homeserver_receive_process/src/main.rs index 4a5be8a..d135421 100644 --- a/homeserver_receive_process/src/main.rs +++ b/homeserver_receive_process/src/main.rs @@ -88,8 +88,11 @@ async fn post_minecraft( ) -> impl Responder { log::info!("post minecraft"); - if state.lock().unwrap().current_executing_count() >= 2 { - return HttpResponse::ExpectationFailed().body("Two games have already been activated."); + { + if state.lock().unwrap().current_executing_count() >= 2 { + return HttpResponse::ExpectationFailed() + .body("Two games have already been activated."); + } } let result = exec_systemctl(&command, Game::MinecraftServerMgpf).await; @@ -116,8 +119,11 @@ async fn post_sdtd( ) -> impl Responder { log::info!("post sdtd"); - if state.lock().unwrap().current_executing_count() >= 2 { - return HttpResponse::ExpectationFailed().body("Two games have already been activated."); + { + if state.lock().unwrap().current_executing_count() >= 2 { + return HttpResponse::ExpectationFailed() + .body("Two games have already been activated."); + } } let result = exec_systemctl(&command, Game::SdtdServer).await; @@ -144,8 +150,11 @@ async fn post_terraria( ) -> impl Responder { log::info!("post terraria"); - if state.lock().unwrap().current_executing_count() >= 2 { - return HttpResponse::ExpectationFailed().body("Two games have already been activated."); + { + if state.lock().unwrap().current_executing_count() >= 2 { + return HttpResponse::ExpectationFailed() + .body("Two games have already been activated."); + } } let result = exec_systemctl(&command, Game::TerrariaServer).await; @@ -172,8 +181,11 @@ async fn post_ark( ) -> impl Responder { log::info!("post ark"); - if state.lock().unwrap().current_executing_count() >= 2 { - return HttpResponse::ExpectationFailed().body("Two games have already been activated."); + { + if state.lock().unwrap().current_executing_count() >= 2 { + return HttpResponse::ExpectationFailed() + .body("Two games have already been activated."); + } } let result = exec_systemctl(&command, Game::ArkServer).await; @@ -200,8 +212,11 @@ async fn post_ark_second( ) -> impl Responder { log::info!("post ark-second"); - if state.lock().unwrap().current_executing_count() >= 2 { - return HttpResponse::ExpectationFailed().body("Two games have already been activated."); + { + if state.lock().unwrap().current_executing_count() >= 2 { + return HttpResponse::ExpectationFailed() + .body("Two games have already been activated."); + } } let result = exec_systemctl(&command, Game::ArkServerSecond).await; @@ -228,8 +243,11 @@ async fn post_ark_third( ) -> impl Responder { log::info!("post ark-third"); - if state.lock().unwrap().current_executing_count() >= 2 { - return HttpResponse::ExpectationFailed().body("Two games have already been activated."); + { + if state.lock().unwrap().current_executing_count() >= 2 { + return HttpResponse::ExpectationFailed() + .body("Two games have already been activated."); + } } let result = exec_systemctl(&command, Game::ArkServerThird).await;