Core/Maps: Unload transports in MapManager::UnloadAll instead of singleton destructor.

Core/Transports: Properly delink units from transports on transport desutruction. - Thanks to Shauren for help.
Core/ObjectAccessor: Unload corpse 'storage' in added UnloadAll method called in WorldRunnable postservice hook.
Core/Master: Change some postservice queries to syncrhonous (direct) execution to ensure execution on shutdown
Core/Master: Remove redundant calls to ACE::init and ACE::fini

These changes were made to fix crash/freeze issues on shutdown.
This commit is contained in:
Machiavelli
2011-01-16 00:08:52 +01:00
parent 58564cc496
commit 52cd2cbd7e
7 changed files with 37 additions and 33 deletions
-4
View File
@@ -72,8 +72,6 @@ void usage(const char *prog)
/// Launch the Trinity server
extern int main(int argc, char **argv)
{
ACE::init();
///- Command line parsing to get the configuration file name
char const* cfg_file = _TRINITY_CORE_CONFIG;
int c=1;
@@ -151,8 +149,6 @@ extern int main(int argc, char **argv)
// 1 - shutdown at error
// 2 - restart command used, this code can be used by restarter for restart Trinityd
ACE::fini();
return ret;
}
+5 -5
View File
@@ -174,7 +174,7 @@ int Master::Run()
CoredSignalHandler SignalBREAK;
#endif /* _WIN32 */
// Register realmd's signal handlers
// Register core's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
@@ -290,7 +290,7 @@ int Master::Run()
}
// set server offline
LoginDatabase.PExecute("UPDATE realmlist SET color = color | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
LoginDatabase.DirectPExecute("UPDATE realmlist SET color = color | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master
@@ -484,12 +484,12 @@ void Master::clearOnlineAccounts()
{
// Cleanup online status for characters hosted at current realm
/// \todo Only accounts with characters logged on *this* realm should have online status reset. Move the online column from 'account' to 'realmcharacters'?
LoginDatabase.PExecute(
LoginDatabase.DirectPExecute(
"UPDATE account SET online = 0 WHERE online > 0 "
"AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = '%d')",realmID);
CharacterDatabase.Execute("UPDATE characters SET online = 0 WHERE online<>0");
CharacterDatabase.DirectExecute("UPDATE characters SET online = 0 WHERE online<>0");
// Battleground instance ids reset at server restart
CharacterDatabase.Execute("UPDATE character_battleground_data SET instance_id = 0");
CharacterDatabase.DirectExecute("UPDATE character_battleground_data SET instance_id = 0");
}
@@ -90,6 +90,6 @@ void WorldRunnable::run()
sWorldSocketMgr->StopNetwork();
sObjectAccessor->UnloadAll(); // unload 'i_player2corpse' storage and remove from world
sMapMgr->UnloadAll(); // unload all grids (including locked in memory)
}