From 123f2ad97e9cc53504b9e0faa1c180f4d979126f Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 17 Dec 2023 23:21:10 +0100 Subject: Core/Bnet: Rewrite LoginRESTService using boost::beast instead of gsoap as http backend and extract generic http code to be reusable elsewhere (cherry picked from commit acb5fbd48b5bd911dd0da6016a3d86d4c64724b6) --- src/server/bnetserver/Main.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/server/bnetserver/Main.cpp') diff --git a/src/server/bnetserver/Main.cpp b/src/server/bnetserver/Main.cpp index e1168a1a90b..6d667cd48b1 100644 --- a/src/server/bnetserver/Main.cpp +++ b/src/server/bnetserver/Main.cpp @@ -200,21 +200,29 @@ int main(int argc, char** argv) Trinity::Net::ScanLocalNetworks(); - // Start the listening port (acceptor) for auth connections - int32 bnport = sConfigMgr->GetIntDefault("BattlenetPort", 1119); - if (bnport < 0 || bnport > 0xFFFF) + std::string httpBindIp = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0"); + int32 httpPort = sConfigMgr->GetIntDefault("LoginREST.Port", 8081); + if (httpPort <= 0 || httpPort > 0xFFFF) { - TC_LOG_ERROR("server.bnetserver", "Specified battle.net port ({}) out of allowed range (1-65535)", bnport); + TC_LOG_ERROR("server.bnetserver", "Specified login service port ({}) out of allowed range (1-65535)", httpPort); return 1; } - if (!sLoginService.Start(ioContext.get())) + if (!sLoginService.StartNetwork(*ioContext, httpBindIp, httpPort)) { TC_LOG_ERROR("server.bnetserver", "Failed to initialize login service"); return 1; } - std::shared_ptr sLoginServiceHandle(nullptr, [](void*) { sLoginService.Stop(); }); + std::shared_ptr sLoginServiceHandle(nullptr, [](void*) { sLoginService.StopNetwork(); }); + + // Start the listening port (acceptor) for auth connections + int32 bnport = sConfigMgr->GetIntDefault("BattlenetPort", 1119); + if (bnport <= 0 || bnport > 0xFFFF) + { + TC_LOG_ERROR("server.bnetserver", "Specified battle.net port ({}) out of allowed range (1-65535)", bnport); + return 1; + } // Get the list of realms for the server sRealmList->Initialize(*ioContext, sConfigMgr->GetIntDefault("RealmsStateUpdateDelay", 10)); -- cgit v1.2.3