*Properly initialize members to prevent DB logging before the DB is started. Fixes a rarely seen startup crash.
*Code cleanup. --HG-- branch : trunk
This commit is contained in:
+1
-3
@@ -1720,10 +1720,8 @@ void World::SetInitialWorldSettings()
|
|||||||
sLog.SetLogDB(true);
|
sLog.SetLogDB(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
sLog.SetLogDB(false);
|
sLog.SetLogDB(false);
|
||||||
sLog.SetLogDBLater(false);
|
|
||||||
}
|
|
||||||
sScriptMgr.OnServerStartup();
|
sScriptMgr.OnServerStartup();
|
||||||
sLog.outString("WORLD: World initialized");
|
sLog.outString("WORLD: World initialized");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
size_t Database::db_count = 0;
|
size_t Database::db_count = 0;
|
||||||
|
|
||||||
Database::Database()
|
Database::Database() : mMysql(NULL)
|
||||||
{
|
{
|
||||||
// before first connection
|
// before first connection
|
||||||
if (db_count++ == 0)
|
if (db_count++ == 0)
|
||||||
|
|||||||
+3
-2
@@ -31,8 +31,9 @@ INSTANTIATE_SINGLETON_1( Log );
|
|||||||
|
|
||||||
Log::Log() :
|
Log::Log() :
|
||||||
raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL),
|
raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL),
|
||||||
dberLogfile(NULL), chatLogfile(NULL), m_gmlog_per_account(false), m_colored(false)
|
dberLogfile(NULL), chatLogfile(NULL), m_gmlog_per_account(false),
|
||||||
, arenaLogFile(NULL)
|
m_enableLogDBLater(false), m_enableLogDB(false), m_colored(false),
|
||||||
|
arenaLogFile(NULL)
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,19 +499,9 @@ bool Master::_StartDB()
|
|||||||
sLog.outString("Realm running as realm ID %d", realmID);
|
sLog.outString("Realm running as realm ID %d", realmID);
|
||||||
|
|
||||||
///- Initialize the DB logging system
|
///- Initialize the DB logging system
|
||||||
if(sConfig.GetBoolDefault("EnableLogDB", false))
|
sLog.SetLogDBLater(sConfig.GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
|
||||||
{
|
|
||||||
// everything successful - set var to enable DB logging once startup finished.
|
|
||||||
sLog.SetLogDBLater(true);
|
|
||||||
sLog.SetLogDB(false);
|
sLog.SetLogDB(false);
|
||||||
sLog.SetRealmID(realmID);
|
sLog.SetRealmID(realmID);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sLog.SetLogDBLater(false);
|
|
||||||
sLog.SetLogDB(false);
|
|
||||||
sLog.SetRealmID(realmID);
|
|
||||||
}
|
|
||||||
|
|
||||||
///- Clean the database before starting
|
///- Clean the database before starting
|
||||||
clearOnlineAccounts();
|
clearOnlineAccounts();
|
||||||
|
|||||||
@@ -199,20 +199,9 @@ extern int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
///- Initialize the log database
|
///- Initialize the log database
|
||||||
if (sConfig.GetBoolDefault("EnableLogDB", false))
|
sLog.SetLogDBLater(sConfig.GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
|
||||||
{
|
|
||||||
// everything successful - set var to enable DB logging once startup finished.
|
|
||||||
sLog.SetLogDBLater(true);
|
|
||||||
sLog.SetLogDB(false);
|
sLog.SetLogDB(false);
|
||||||
// ensure we've set realm to 0 (realmd realmid)
|
sLog.SetRealmID(0); // ensure we've set realm to 0 (realmd realmid)
|
||||||
sLog.SetRealmID(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sLog.SetLogDBLater(false);
|
|
||||||
sLog.SetLogDB(false);
|
|
||||||
sLog.SetRealmID(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
///- Get the list of realms for the server
|
///- Get the list of realms for the server
|
||||||
sRealmList->Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
|
sRealmList->Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
|
||||||
@@ -306,10 +295,7 @@ extern int main(int argc, char **argv)
|
|||||||
sLog.SetLogDB(true);
|
sLog.SetLogDB(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
sLog.SetLogDB(false);
|
sLog.SetLogDB(false);
|
||||||
sLog.SetLogDBLater(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
///- Wait for termination signal
|
///- Wait for termination signal
|
||||||
while (!stopEvent)
|
while (!stopEvent)
|
||||||
|
|||||||
Reference in New Issue
Block a user