aboutsummaryrefslogtreecommitdiff
path: root/src/server/worldserver/Main.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-04-30 00:20:38 +0200
committerOvahlord <dreadkiller@gmx.de>2024-05-28 16:47:32 +0200
commit3cf1aaaf56f0f7e556dfaa7b3516c1a52abacb8f (patch)
tree69c30943bd575f0c40a61fdfd9d1bb1bd217983b /src/server/worldserver/Main.cpp
parentbeb9b4607d0f8309ae25c2a01596b42b250559c7 (diff)
Core/Misc: Refactor loading process to remove exit() calls that cause deadlocks because threads are terminated without proper cleanup
(cherry picked from commit 8e3024a96ab06b5e2d6da529c5e3db9ce5744c4e)
Diffstat (limited to 'src/server/worldserver/Main.cpp')
-rw-r--r--src/server/worldserver/Main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 1aa1de63d02..f8eba01c60c 100644
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -338,7 +338,8 @@ extern int main(int argc, char** argv)
// Initialize the World
sSecretMgr->Initialize(SECRET_OWNER_WORLDSERVER);
- sWorld->SetInitialWorldSettings();
+ if (!sWorld->SetInitialWorldSettings())
+ return 1;
auto mapManagementHandle = Trinity::make_unique_ptr_with_deleter(&dummy, [](void*)
{
@@ -359,7 +360,12 @@ extern int main(int argc, char** argv)
// Start soap serving thread if enabled
std::unique_ptr<std::thread, ShutdownTCSoapThread> 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))));
+ {
+ if (std::thread* soap = CreateSoapThread(sConfigMgr->GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfigMgr->GetIntDefault("SOAP.Port", 7878))))
+ soapThread.reset(soap);
+ else
+ return -1;
+ }
// Launch the worldserver listener socket
uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD));