*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:
Xanadu
2010-05-29 03:16:39 +02:00
parent de97bd4f00
commit d104f19469
5 changed files with 12 additions and 37 deletions

View File

@@ -1720,10 +1720,8 @@ void World::SetInitialWorldSettings()
sLog.SetLogDB(true);
}
else
{
sLog.SetLogDB(false);
sLog.SetLogDBLater(false);
}
sScriptMgr.OnServerStartup();
sLog.outString("WORLD: World initialized");
}

View File

@@ -39,7 +39,7 @@
size_t Database::db_count = 0;
Database::Database()
Database::Database() : mMysql(NULL)
{
// before first connection
if (db_count++ == 0)

View File

@@ -31,8 +31,9 @@ INSTANTIATE_SINGLETON_1( Log );
Log::Log() :
raLogfile(NULL), logfile(NULL), gmLogfile(NULL), charLogfile(NULL),
dberLogfile(NULL), chatLogfile(NULL), m_gmlog_per_account(false), m_colored(false)
, arenaLogFile(NULL)
dberLogfile(NULL), chatLogfile(NULL), m_gmlog_per_account(false),
m_enableLogDBLater(false), m_enableLogDB(false), m_colored(false),
arenaLogFile(NULL)
{
Initialize();
}

View File

@@ -499,19 +499,9 @@ bool Master::_StartDB()
sLog.outString("Realm running as realm ID %d", realmID);
///- Initialize the DB logging system
if(sConfig.GetBoolDefault("EnableLogDB", false))
{
// everything successful - set var to enable DB logging once startup finished.
sLog.SetLogDBLater(true);
sLog.SetLogDB(false);
sLog.SetRealmID(realmID);
}
else
{
sLog.SetLogDBLater(false);
sLog.SetLogDB(false);
sLog.SetRealmID(realmID);
}
sLog.SetLogDBLater(sConfig.GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
sLog.SetLogDB(false);
sLog.SetRealmID(realmID);
///- Clean the database before starting
clearOnlineAccounts();

View File

@@ -199,21 +199,10 @@ extern int main(int argc, char **argv)
return 1;
///- Initialize the log database
if (sConfig.GetBoolDefault("EnableLogDB", false))
{
// everything successful - set var to enable DB logging once startup finished.
sLog.SetLogDBLater(true);
sLog.SetLogDB(false);
// ensure we've set realm to 0 (realmd realmid)
sLog.SetRealmID(0);
}
else
{
sLog.SetLogDBLater(false);
sLog.SetLogDB(false);
sLog.SetRealmID(0);
}
sLog.SetLogDBLater(sConfig.GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
sLog.SetLogDB(false);
sLog.SetRealmID(0); // ensure we've set realm to 0 (realmd realmid)
///- Get the list of realms for the server
sRealmList->Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
@@ -306,10 +295,7 @@ extern int main(int argc, char **argv)
sLog.SetLogDB(true);
}
else
{
sLog.SetLogDB(false);
sLog.SetLogDBLater(false);
}
///- Wait for termination signal
while (!stopEvent)