Core/Misc: Refactor loading process to remove exit() calls that cause deadlocks because threads are terminated without proper cleanup

Port From (https://github.com/TrinityCore/TrinityCore/commit/8e3024a96ab06b5e2d6da529c5e3db9ce5744c4e)
This commit is contained in:
Hondacrx
2024-08-19 13:48:46 -04:00
parent d33f86799f
commit 2405543be4
2 changed files with 9 additions and 6 deletions
+7 -5
View File
@@ -379,7 +379,7 @@ namespace Game
return found; return found;
} }
public void SetInitialWorldSettings() public bool SetInitialWorldSettings()
{ {
LoadRealmInfo(); LoadRealmInfo();
@@ -397,8 +397,8 @@ namespace Game
|| !TerrainManager.ExistMapAndVMap(1, 10311.3f, 832.463f) || !TerrainManager.ExistMapAndVMap(1, -2917.58f, -257.98f) || !TerrainManager.ExistMapAndVMap(1, 10311.3f, 832.463f) || !TerrainManager.ExistMapAndVMap(1, -2917.58f, -257.98f)
|| (WorldConfig.GetIntValue(WorldCfg.Expansion) != 0 && (!TerrainManager.ExistMapAndVMap(530, 10349.6f, -6357.29f) || !TerrainManager.ExistMapAndVMap(530, -3961.64f, -13931.2f)))) || (WorldConfig.GetIntValue(WorldCfg.Expansion) != 0 && (!TerrainManager.ExistMapAndVMap(530, 10349.6f, -6357.29f) || !TerrainManager.ExistMapAndVMap(530, -3961.64f, -13931.2f))))
{ {
Log.outError(LogFilter.ServerLoading, "Unable to load map and vmap data for starting zones - server shutting down!"); Log.outFatal(LogFilter.ServerLoading, "Unable to load map and vmap data for starting zones - server shutting down!");
Environment.Exit(1); return false;
} }
// Initialize pool manager // Initialize pool manager
@@ -423,14 +423,14 @@ namespace Game
if (m_availableDbcLocaleMask == null || !m_availableDbcLocaleMask[(int)m_defaultDbcLocale]) if (m_availableDbcLocaleMask == null || !m_availableDbcLocaleMask[(int)m_defaultDbcLocale])
{ {
Log.outFatal(LogFilter.ServerLoading, $"Unable to load db2 files for {m_defaultDbcLocale} locale specified in DBC.Locale config!"); Log.outFatal(LogFilter.ServerLoading, $"Unable to load db2 files for {m_defaultDbcLocale} locale specified in DBC.Locale config!");
Environment.Exit(1); return false;
} }
Log.outInfo(LogFilter.ServerLoading, "Loading GameObject models..."); Log.outInfo(LogFilter.ServerLoading, "Loading GameObject models...");
if (!GameObjectModel.LoadGameObjectModelList()) if (!GameObjectModel.LoadGameObjectModelList())
{ {
Log.outFatal(LogFilter.ServerLoading, "Unable to load gameobject models (part of vmaps), objects using WMO models will crash the client - server shutting down!"); Log.outFatal(LogFilter.ServerLoading, "Unable to load gameobject models (part of vmaps), objects using WMO models will crash the client - server shutting down!");
Environment.Exit(1); return false;
} }
Log.outInfo(LogFilter.ServerLoading, "Loading hotfix blobs..."); Log.outInfo(LogFilter.ServerLoading, "Loading hotfix blobs...");
@@ -1132,6 +1132,8 @@ namespace Game
Log.outInfo(LogFilter.ServerLoading, "Loading phase names..."); Log.outInfo(LogFilter.ServerLoading, "Loading phase names...");
Global.ObjectMgr.LoadPhaseNames(); Global.ObjectMgr.LoadPhaseNames();
return true;
} }
public void LoadConfigSettings(bool reload = false) public void LoadConfigSettings(bool reload = false)
+2 -1
View File
@@ -41,7 +41,8 @@ namespace WorldServer
Global.RealmMgr.Initialize(ConfigMgr.GetDefaultValue("RealmsStateUpdateDelay", 10)); Global.RealmMgr.Initialize(ConfigMgr.GetDefaultValue("RealmsStateUpdateDelay", 10));
Global.WorldMgr.SetInitialWorldSettings(); if (!Global.WorldMgr.SetInitialWorldSettings())
ExitNow();
// Start the Remote Access port (acceptor) if enabled // Start the Remote Access port (acceptor) if enabled
if (ConfigMgr.GetDefaultValue("Ra.Enable", false)) if (ConfigMgr.GetDefaultValue("Ra.Enable", false))