Core/Misc: Update 85e3169fbd 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.
This commit is contained in:
jackpoz
2019-01-18 22:57:23 +01:00
parent 46f2595f51
commit d05ab073cb

View File

@@ -261,6 +261,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));
std::string worldListener = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0");
@@ -270,12 +282,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, networkThreads))
{
TC_LOG_ERROR("server.worldserver", "Failed to initialize network");
World::StopNow(ERROR_EXIT_CODE);
return 1;
}
@@ -290,18 +304,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