diff options
author | jackpoz <giacomopoz@gmail.com> | 2019-01-18 22:57:23 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-11-21 20:16:46 +0100 |
commit | d532420d798dc2f95379f8108d04687097d043a3 (patch) | |
tree | 27cbc7af5c96a68ddacbb7a99badf4c0d4c283b0 /src | |
parent | f83601de2f0d4e42afcdb4951e170b7b9450643e (diff) |
Core/Misc: Update 85e3169fbd7b2da70e0f054399f4db64ded36325 about SOAP
Change again how SOAP is stopped if SOAP successfully binds but worldserver fails to bind its sockets.
A crash remains if SOAP fails to bind because it calls exit() and that triggers asserts everywhere.
(cherry picked from commit d05ab073cb102a4f868b0fda51ef4368350ded32)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/worldserver/Main.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index dfc1e5a4e1f..1ed4ade155e 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -273,6 +273,18 @@ extern int main(int argc, char** argv) if (sConfigMgr->GetBoolDefault("Ra.Enable", false)) raAcceptor.reset(StartRaSocketAcceptor(*ioContext)); + // Start soap serving thread if enabled + std::shared_ptr<std::thread> soapThread; + if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false)) + { + soapThread.reset(new std::thread(TCSoapThread, sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878))), + [](std::thread* thr) + { + thr->join(); + delete thr; + }); + } + // Launch the worldserver listener socket uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD)); uint16 instancePort = uint16(sWorld->getIntConfig(CONFIG_PORT_INSTANCE)); @@ -283,12 +295,14 @@ extern int main(int argc, char** argv) if (networkThreads <= 0) { TC_LOG_ERROR("server.worldserver", "Network.Threads must be greater than 0"); + World::StopNow(ERROR_EXIT_CODE); return 1; } if (!sWorldSocketMgr.StartWorldNetwork(*ioContext, worldListener, worldPort, instancePort, networkThreads)) { TC_LOG_ERROR("server.worldserver", "Failed to initialize network"); + World::StopNow(ERROR_EXIT_CODE); return 1; } @@ -303,18 +317,6 @@ extern int main(int argc, char** argv) ClearOnlineAccounts(); }); - // Start soap serving thread if enabled - std::shared_ptr<std::thread> soapThread; - if (sConfigMgr->GetBoolDefault("SOAP.Enabled", false)) - { - soapThread.reset(new std::thread(TCSoapThread, sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878))), - [](std::thread* thr) - { - thr->join(); - delete thr; - }); - } - // Launch CliRunnable thread std::shared_ptr<std::thread> cliThread; #ifdef _WIN32 |