From 2c0bf1c40733920e5205118327027b38dc6cbe9d Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 8 Oct 2022 20:08:54 +0200 Subject: Core/Misc: Minor cleanup in worldserver main.cpp --- src/server/worldserver/Main.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/server/worldserver/Main.cpp') diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 9bf26b84ef5..68978183f51 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -95,7 +95,10 @@ class FreezeDetector static void Start(std::shared_ptr const& freezeDetector) { freezeDetector->_timer.expires_from_now(boost::posix_time::seconds(5)); - freezeDetector->_timer.async_wait(std::bind(&FreezeDetector::Handler, std::weak_ptr(freezeDetector), std::placeholders::_1)); + freezeDetector->_timer.async_wait([freezeDetectorRef = std::weak_ptr(freezeDetector)](boost::system::error_code const& error) + { + return Handler(freezeDetectorRef, error); + }); } static void Handler(std::weak_ptr freezeDetectorRef, boost::system::error_code const& error); @@ -115,7 +118,7 @@ void WorldUpdateLoop(); void ClearOnlineAccounts(); void ShutdownCLIThread(std::thread* cliThread); bool LoadRealmInfo(Trinity::Asio::IoContext& ioContext); -variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, std::string& cfg_service); +variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, std::string& configService); /// Launch the Trinity server extern int main(int argc, char** argv) @@ -132,12 +135,12 @@ extern int main(int argc, char** argv) return 0; #ifdef _WIN32 - if (configService.compare("install") == 0) - return WinServiceInstall() == true ? 0 : 1; - else if (configService.compare("uninstall") == 0) - return WinServiceUninstall() == true ? 0 : 1; - else if (configService.compare("run") == 0) - WinServiceRun(); + if (configService == "install") + return WinServiceInstall() ? 0 : 1; + else if (configService == "uninstall") + return WinServiceUninstall() ? 0 : 1; + else if (configService == "run") + return WinServiceRun() ? 0 : 1; Optional newTimerResolution; boost::system::error_code dllError; @@ -546,7 +549,10 @@ void FreezeDetector::Handler(std::weak_ptr freezeDetectorRef, bo } freezeDetector->_timer.expires_from_now(boost::posix_time::seconds(1)); - freezeDetector->_timer.async_wait(std::bind(&FreezeDetector::Handler, freezeDetectorRef, std::placeholders::_1)); + freezeDetector->_timer.async_wait([freezeDetectorRef](boost::system::error_code const& timerError) + { + return Handler(freezeDetectorRef, timerError); + }); } } } -- cgit v1.2.3