mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-27 20:32:21 +01:00
Core: Removed more operator workarounds for ACE_Singleton (missed previously because of inconsistent naming)
--HG-- branch : trunk
This commit is contained in:
@@ -412,7 +412,7 @@ bool ChatHandler::HandleCharacterDeletedDeleteCommand(const char* args)
|
||||
*/
|
||||
bool ChatHandler::HandleCharacterDeletedOldCommand(const char* args)
|
||||
{
|
||||
int32 keepDays = sWorld.getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS);
|
||||
int32 keepDays = sWorld->getIntConfig(CONFIG_CHARDELETE_KEEP_DAYS);
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
if (px)
|
||||
@@ -493,7 +493,7 @@ bool ChatHandler::HandleServerSetLogFileLevelCommand(const char *args)
|
||||
if (!NewLevel)
|
||||
return false;
|
||||
|
||||
sLog.SetLogFileLevel(NewLevel);
|
||||
sLog->SetLogFileLevel(NewLevel);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ bool ChatHandler::HandleServerSetLogLevelCommand(const char *args)
|
||||
if (!NewLevel)
|
||||
return false;
|
||||
|
||||
sLog.SetLogLevel(NewLevel);
|
||||
sLog->SetLogLevel(NewLevel);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ bool ChatHandler::HandleServerSetDiffTimeCommand(const char *args)
|
||||
if (NewTime < 0)
|
||||
return false;
|
||||
|
||||
sWorld.SetRecordDiffInterval(NewTime);
|
||||
sWorld->SetRecordDiffInterval(NewTime);
|
||||
printf( "Record diff every %u ms\n", NewTime);
|
||||
return true;
|
||||
}
|
||||
@@ -533,8 +533,8 @@ bool ChatHandler::HandleServerSetDiffTimeCommand(const char *args)
|
||||
/// toggle sql driver query logging
|
||||
bool ChatHandler::HandleServerToggleQueryLogging(const char* /* args */)
|
||||
{
|
||||
sLog.SetSQLDriverQueryLogging(!sLog.GetSQLDriverQueryLogging());
|
||||
if(sLog.GetSQLDriverQueryLogging())
|
||||
sLog->SetSQLDriverQueryLogging(!sLog->GetSQLDriverQueryLogging());
|
||||
if(sLog->GetSQLDriverQueryLogging())
|
||||
PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_ENABLED);
|
||||
else
|
||||
PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_DISABLED);
|
||||
@@ -563,12 +563,12 @@ int kb_hit_return()
|
||||
void CliRunnable::run()
|
||||
{
|
||||
///- Display the list of available CLI functions then beep
|
||||
//sLog.outString("");
|
||||
//sLog->outString("");
|
||||
#if PLATFORM != WINDOWS
|
||||
rl_attempted_completion_function = cli_completion;
|
||||
rl_event_hook = cli_hook_func;
|
||||
#endif
|
||||
if (sConfig.GetBoolDefault("BeepAtStart", true))
|
||||
if (sConfig->GetBoolDefault("BeepAtStart", true))
|
||||
printf("\a"); // \a = Alert
|
||||
|
||||
// print this here the first time
|
||||
@@ -615,7 +615,7 @@ void CliRunnable::run()
|
||||
continue;
|
||||
}
|
||||
fflush(stdout);
|
||||
sWorld.QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished));
|
||||
sWorld->QueueCliCommand(new CliCommandHolder(NULL, command.c_str(), &utf8print, &commandFinished));
|
||||
#if PLATFORM != WINDOWS
|
||||
add_history(command.c_str());
|
||||
#endif
|
||||
|
||||
@@ -58,7 +58,7 @@ uint32 realmID; ///< Id of the realm
|
||||
/// Print out the usage string for this program on the console.
|
||||
void usage(const char *prog)
|
||||
{
|
||||
sLog.outString("Usage: \n %s [<options>]\n"
|
||||
sLog->outString("Usage: \n %s [<options>]\n"
|
||||
" -c config_file use config_file as configuration file\n\r"
|
||||
#ifdef _WIN32
|
||||
" Running as service functions:\n\r"
|
||||
@@ -83,7 +83,7 @@ extern int main(int argc, char **argv)
|
||||
{
|
||||
if( ++c >= argc )
|
||||
{
|
||||
sLog.outError("Runtime-Error: -c option requires an input argument");
|
||||
sLog->outError("Runtime-Error: -c option requires an input argument");
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
@@ -99,25 +99,25 @@ extern int main(int argc, char **argv)
|
||||
{
|
||||
if( ++c >= argc )
|
||||
{
|
||||
sLog.outError("Runtime-Error: -s option requires an input argument");
|
||||
sLog->outError("Runtime-Error: -s option requires an input argument");
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if( strcmp(argv[c],"install") == 0)
|
||||
{
|
||||
if (WinServiceInstall())
|
||||
sLog.outString("Installing service");
|
||||
sLog->outString("Installing service");
|
||||
return 1;
|
||||
}
|
||||
else if( strcmp(argv[c],"uninstall") == 0)
|
||||
{
|
||||
if(WinServiceUninstall())
|
||||
sLog.outString("Uninstalling service");
|
||||
sLog->outString("Uninstalling service");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outError("Runtime-Error: unsupported option %s",argv[c]);
|
||||
sLog->outError("Runtime-Error: unsupported option %s",argv[c]);
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
@@ -131,20 +131,20 @@ extern int main(int argc, char **argv)
|
||||
++c;
|
||||
}
|
||||
|
||||
if (!sConfig.SetSource(cfg_file))
|
||||
if (!sConfig->SetSource(cfg_file))
|
||||
{
|
||||
sLog.outError("Invalid or missing configuration file : %s", cfg_file);
|
||||
sLog.outError("Verify that the file exists and has \'[worldserver]' written in the top of the file!");
|
||||
sLog->outError("Invalid or missing configuration file : %s", cfg_file);
|
||||
sLog->outError("Verify that the file exists and has \'[worldserver]' written in the top of the file!");
|
||||
return 1;
|
||||
}
|
||||
sLog.outString("Using configuration file %s.", cfg_file);
|
||||
sLog->outString("Using configuration file %s.", cfg_file);
|
||||
|
||||
sLog.outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
|
||||
sLog.outDetail("Using ACE: %s", ACE_VERSION);
|
||||
sLog->outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
|
||||
sLog->outDetail("Using ACE: %s", ACE_VERSION);
|
||||
|
||||
///- and run the 'Master'
|
||||
/// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd?
|
||||
int ret = sMaster.Run();
|
||||
int ret = sMaster->Run();
|
||||
|
||||
// at sMaster return function exist with codes
|
||||
// 0 - normal shutdown
|
||||
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
{
|
||||
if (!_delaytime)
|
||||
return;
|
||||
sLog.outString("Starting up anti-freeze thread (%u seconds max stuck time)...",_delaytime/1000);
|
||||
sLog->outString("Starting up anti-freeze thread (%u seconds max stuck time)...",_delaytime/1000);
|
||||
m_loops = 0;
|
||||
w_loops = 0;
|
||||
m_lastchange = 0;
|
||||
@@ -100,11 +100,11 @@ public:
|
||||
// possible freeze
|
||||
else if (getMSTimeDiff(w_lastchange,curtime) > _delaytime)
|
||||
{
|
||||
sLog.outError("World Thread hangs, kicking out server!");
|
||||
sLog->outError("World Thread hangs, kicking out server!");
|
||||
*((uint32 volatile*)NULL) = 0; // bang crash
|
||||
}
|
||||
}
|
||||
sLog.outString("Anti-freeze thread exiting without problems.");
|
||||
sLog->outString("Anti-freeze thread exiting without problems.");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -122,38 +122,38 @@ int Master::Run()
|
||||
BigNumber seed1;
|
||||
seed1.SetRand(16 * 8);
|
||||
|
||||
sLog.outString( "%s (core-daemon)", _FULLVERSION );
|
||||
sLog.outString( "<Ctrl-C> to stop.\n" );
|
||||
sLog->outString( "%s (core-daemon)", _FULLVERSION );
|
||||
sLog->outString( "<Ctrl-C> to stop.\n" );
|
||||
|
||||
sLog.outString( " ______ __");
|
||||
sLog.outString( "/\\__ _\\ __ __/\\ \\__");
|
||||
sLog.outString( "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\ ,_\\ __ __");
|
||||
sLog.outString( " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
|
||||
sLog.outString( " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
|
||||
sLog.outString( " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
|
||||
sLog.outString( " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
|
||||
sLog.outString( " C O R E /\\___/");
|
||||
sLog.outString( "http://TrinityCore.org \\/__/\n");
|
||||
sLog->outString( " ______ __");
|
||||
sLog->outString( "/\\__ _\\ __ __/\\ \\__");
|
||||
sLog->outString( "\\/_/\\ \\/ _ __ /\\_\\ ___ /\\_\\ \\ ,_\\ __ __");
|
||||
sLog->outString( " \\ \\ \\/\\`'__\\/\\ \\ /' _ `\\/\\ \\ \\ \\/ /\\ \\/\\ \\");
|
||||
sLog->outString( " \\ \\ \\ \\ \\/ \\ \\ \\/\\ \\/\\ \\ \\ \\ \\ \\_\\ \\ \\_\\ \\");
|
||||
sLog->outString( " \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\_\\ \\_\\ \\__\\\\/`____ \\");
|
||||
sLog->outString( " \\/_/\\/_/ \\/_/\\/_/\\/_/\\/_/\\/__/ `/___/> \\");
|
||||
sLog->outString( " C O R E /\\___/");
|
||||
sLog->outString( "http://TrinityCore.org \\/__/\n");
|
||||
|
||||
#ifdef USE_SFMT_FOR_RNG
|
||||
sLog.outString( "\n");
|
||||
sLog.outString( "SFMT has been enabled as the random number generator, if worldserver");
|
||||
sLog.outString( "freezes or crashes randomly, first, try disabling SFMT in CMAKE configuration");
|
||||
sLog.outString( "\n");
|
||||
sLog->outString( "\n");
|
||||
sLog->outString( "SFMT has been enabled as the random number generator, if worldserver");
|
||||
sLog->outString( "freezes or crashes randomly, first, try disabling SFMT in CMAKE configuration");
|
||||
sLog->outString( "\n");
|
||||
#endif //USE_SFMT_FOR_RNG
|
||||
|
||||
/// worldd PID file creation
|
||||
std::string pidfile = sConfig.GetStringDefault("PidFile", "");
|
||||
std::string pidfile = sConfig->GetStringDefault("PidFile", "");
|
||||
if(!pidfile.empty())
|
||||
{
|
||||
uint32 pid = CreatePIDFile(pidfile);
|
||||
if( !pid )
|
||||
{
|
||||
sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() );
|
||||
sLog->outError( "Cannot create PID file %s.\n", pidfile.c_str() );
|
||||
return 1;
|
||||
}
|
||||
|
||||
sLog.outString( "Daemon PID: %u\n", pid );
|
||||
sLog->outString( "Daemon PID: %u\n", pid );
|
||||
}
|
||||
|
||||
///- Start the databases
|
||||
@@ -161,7 +161,7 @@ int Master::Run()
|
||||
return 1;
|
||||
|
||||
///- Initialize the World
|
||||
sWorld.SetInitialWorldSettings();
|
||||
sWorld->SetInitialWorldSettings();
|
||||
|
||||
|
||||
// Initialise the signal handlers
|
||||
@@ -189,9 +189,9 @@ int Master::Run()
|
||||
ACE_Based::Thread* cliThread = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (sConfig.GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
|
||||
if (sConfig->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
|
||||
#else
|
||||
if (sConfig.GetBoolDefault("Console.Enable", true))
|
||||
if (sConfig->GetBoolDefault("Console.Enable", true))
|
||||
#endif
|
||||
{
|
||||
///- Launch CliRunnable thread
|
||||
@@ -205,7 +205,7 @@ int Master::Run()
|
||||
{
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
|
||||
uint32 Aff = sConfig.GetIntDefault("UseProcessors", 0);
|
||||
uint32 Aff = sConfig->GetIntDefault("UseProcessors", 0);
|
||||
if(Aff > 0)
|
||||
{
|
||||
ULONG_PTR appAff;
|
||||
@@ -217,39 +217,39 @@ int Master::Run()
|
||||
|
||||
if(!curAff )
|
||||
{
|
||||
sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for Trinityd. Accessible processors bitmask (hex): %x",Aff,appAff);
|
||||
sLog->outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for Trinityd. Accessible processors bitmask (hex): %x",Aff,appAff);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(SetProcessAffinityMask(hProcess,curAff))
|
||||
sLog.outString("Using processors (bitmask, hex): %x", curAff);
|
||||
sLog->outString("Using processors (bitmask, hex): %x", curAff);
|
||||
else
|
||||
sLog.outError("Can't set used processors (hex): %x",curAff);
|
||||
sLog->outError("Can't set used processors (hex): %x",curAff);
|
||||
}
|
||||
}
|
||||
sLog.outString("");
|
||||
sLog->outString("");
|
||||
}
|
||||
|
||||
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
|
||||
bool Prio = sConfig->GetBoolDefault("ProcessPriority", false);
|
||||
|
||||
// if(Prio && (m_ServiceStatus == -1)/* need set to default process priority class in service mode*/)
|
||||
if(Prio)
|
||||
{
|
||||
if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
|
||||
sLog.outString("TrinityCore process priority class set to HIGH");
|
||||
sLog->outString("TrinityCore process priority class set to HIGH");
|
||||
else
|
||||
sLog.outError("Can't set Trinityd process priority class.");
|
||||
sLog.outString("");
|
||||
sLog->outError("Can't set Trinityd process priority class.");
|
||||
sLog->outString("");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//Start soap serving thread
|
||||
ACE_Based::Thread* soap_thread = NULL;
|
||||
|
||||
if(sConfig.GetBoolDefault("SOAP.Enabled", false))
|
||||
if(sConfig->GetBoolDefault("SOAP.Enabled", false))
|
||||
{
|
||||
TCSoapRunnable *runnable = new TCSoapRunnable();
|
||||
runnable->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig.GetIntDefault("SOAP.Port", 7878));
|
||||
runnable->setListenArguments(sConfig->GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig->GetIntDefault("SOAP.Port", 7878));
|
||||
soap_thread = new ACE_Based::Thread(runnable);
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ int Master::Run()
|
||||
realCurrTime = realPrevTime = getMSTime();
|
||||
|
||||
///- Start up freeze catcher thread
|
||||
if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0))
|
||||
if(uint32 freeze_delay = sConfig->GetIntDefault("MaxCoreStuckTime", 0))
|
||||
{
|
||||
FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();
|
||||
fdr->SetDelayTime(freeze_delay*1000);
|
||||
@@ -266,12 +266,12 @@ int Master::Run()
|
||||
}
|
||||
|
||||
///- Launch the world listener socket
|
||||
uint16 wsport = sWorld.getIntConfig(CONFIG_PORT_WORLD);
|
||||
std::string bind_ip = sConfig.GetStringDefault ("BindIP", "0.0.0.0");
|
||||
uint16 wsport = sWorld->getIntConfig(CONFIG_PORT_WORLD);
|
||||
std::string bind_ip = sConfig->GetStringDefault ("BindIP", "0.0.0.0");
|
||||
|
||||
if (sWorldSocketMgr->StartNetwork (wsport, bind_ip.c_str ()) == -1)
|
||||
{
|
||||
sLog.outError ("Failed to start network");
|
||||
sLog->outError ("Failed to start network");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
// go down and shutdown the server
|
||||
}
|
||||
@@ -301,7 +301,7 @@ int Master::Run()
|
||||
WorldDatabase.Close();
|
||||
LoginDatabase.Close();
|
||||
|
||||
sLog.outString( "Halting process..." );
|
||||
sLog->outString( "Halting process..." );
|
||||
|
||||
if (cliThread)
|
||||
{
|
||||
@@ -364,95 +364,95 @@ int Master::Run()
|
||||
/// Initialize connection to the databases
|
||||
bool Master::_StartDB()
|
||||
{
|
||||
sLog.SetLogDB(false);
|
||||
sLog->SetLogDB(false);
|
||||
std::string dbstring;
|
||||
uint8 async_threads, synch_threads;
|
||||
|
||||
dbstring = sConfig.GetStringDefault("WorldDatabaseInfo", "");
|
||||
dbstring = sConfig->GetStringDefault("WorldDatabaseInfo", "");
|
||||
if (dbstring.empty())
|
||||
{
|
||||
sLog.outError("World database not specified in configuration file");
|
||||
sLog->outError("World database not specified in configuration file");
|
||||
return false;
|
||||
}
|
||||
|
||||
async_threads = sConfig.GetIntDefault("WorldDatabase.WorkerThreads", 1);
|
||||
async_threads = sConfig->GetIntDefault("WorldDatabase.WorkerThreads", 1);
|
||||
if (async_threads < 1 || async_threads > 32)
|
||||
{
|
||||
sLog.outError("World database: invalid number of worker threads specified. "
|
||||
sLog->outError("World database: invalid number of worker threads specified. "
|
||||
"Please pick a value between 1 and 32.");
|
||||
return false;
|
||||
}
|
||||
|
||||
synch_threads = sConfig.GetIntDefault("WorldDatabase.SynchThreads", 1);
|
||||
synch_threads = sConfig->GetIntDefault("WorldDatabase.SynchThreads", 1);
|
||||
|
||||
///- Initialise the world database
|
||||
if (!WorldDatabase.Open(dbstring, async_threads, synch_threads))
|
||||
{
|
||||
sLog.outError("Cannot connect to world database %s", dbstring.c_str());
|
||||
sLog->outError("Cannot connect to world database %s", dbstring.c_str());
|
||||
return false;
|
||||
}
|
||||
///- Get character database info from configuration file
|
||||
dbstring = sConfig.GetStringDefault("CharacterDatabaseInfo", "");
|
||||
dbstring = sConfig->GetStringDefault("CharacterDatabaseInfo", "");
|
||||
if (dbstring.empty())
|
||||
{
|
||||
sLog.outError("Character database not specified in configuration file");
|
||||
sLog->outError("Character database not specified in configuration file");
|
||||
return false;
|
||||
}
|
||||
|
||||
async_threads = sConfig.GetIntDefault("CharacterDatabase.WorkerThreads", 1);
|
||||
async_threads = sConfig->GetIntDefault("CharacterDatabase.WorkerThreads", 1);
|
||||
if (async_threads < 1 || async_threads > 32)
|
||||
{
|
||||
sLog.outError("Character database: invalid number of worker threads specified. "
|
||||
sLog->outError("Character database: invalid number of worker threads specified. "
|
||||
"Please pick a value between 1 and 32.");
|
||||
return false;
|
||||
}
|
||||
|
||||
synch_threads = sConfig.GetIntDefault("CharacterDatabase.SynchThreads", 2);
|
||||
synch_threads = sConfig->GetIntDefault("CharacterDatabase.SynchThreads", 2);
|
||||
|
||||
///- Initialise the Character database
|
||||
if (!CharacterDatabase.Open(dbstring, async_threads, synch_threads))
|
||||
{
|
||||
sLog.outError("Cannot connect to Character database %s", dbstring.c_str());
|
||||
sLog->outError("Cannot connect to Character database %s", dbstring.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
///- Get login database info from configuration file
|
||||
dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", "");
|
||||
dbstring = sConfig->GetStringDefault("LoginDatabaseInfo", "");
|
||||
if (dbstring.empty())
|
||||
{
|
||||
sLog.outError("Login database not specified in configuration file");
|
||||
sLog->outError("Login database not specified in configuration file");
|
||||
return false;
|
||||
}
|
||||
|
||||
async_threads = sConfig.GetIntDefault("LoginDatabase.WorkerThreads", 1);
|
||||
async_threads = sConfig->GetIntDefault("LoginDatabase.WorkerThreads", 1);
|
||||
if (async_threads < 1 || async_threads > 32)
|
||||
{
|
||||
sLog.outError("Login database: invalid number of worker threads specified. "
|
||||
sLog->outError("Login database: invalid number of worker threads specified. "
|
||||
"Please pick a value between 1 and 32.");
|
||||
return false;
|
||||
}
|
||||
|
||||
synch_threads = sConfig.GetIntDefault("LoginDatabase.SynchThreads", 1);
|
||||
synch_threads = sConfig->GetIntDefault("LoginDatabase.SynchThreads", 1);
|
||||
|
||||
///- Initialise the login database
|
||||
if (!LoginDatabase.Open(dbstring, async_threads, synch_threads))
|
||||
{
|
||||
sLog.outError("Cannot connect to login database %s", dbstring.c_str());
|
||||
sLog->outError("Cannot connect to login database %s", dbstring.c_str());
|
||||
return false;
|
||||
}
|
||||
///- Get the realm Id from the configuration file
|
||||
realmID = sConfig.GetIntDefault("RealmID", 0);
|
||||
realmID = sConfig->GetIntDefault("RealmID", 0);
|
||||
if (!realmID)
|
||||
{
|
||||
sLog.outError("Realm ID not defined in configuration file");
|
||||
sLog->outError("Realm ID not defined in configuration file");
|
||||
return false;
|
||||
}
|
||||
sLog.outString("Realm running as realm ID %d", realmID);
|
||||
sLog->outString("Realm running as realm ID %d", realmID);
|
||||
|
||||
///- Initialize the DB logging system
|
||||
sLog.SetLogDBLater(sConfig.GetBoolDefault("EnableLogDB", false)); // set var to enable DB logging once startup finished.
|
||||
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();
|
||||
@@ -460,10 +460,10 @@ bool Master::_StartDB()
|
||||
///- Insert version info into DB
|
||||
WorldDatabase.PExecute("UPDATE version SET core_version = '%s', core_revision = '%s'", _FULLVERSION, _REVISION);
|
||||
|
||||
sWorld.LoadDBVersion();
|
||||
sWorld->LoadDBVersion();
|
||||
|
||||
sLog.outString("Using World DB: %s", sWorld.GetDBVersion());
|
||||
sLog.outString("Using creature EventAI: %s", sWorld.GetCreatureEventAIVersion());
|
||||
sLog->outString("Using World DB: %s", sWorld->GetDBVersion());
|
||||
sLog->outString("Using creature EventAI: %s", sWorld->GetCreatureEventAIVersion());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,6 @@ class Master
|
||||
void clearOnlineAccounts();
|
||||
};
|
||||
|
||||
#define sMaster (*ACE_Singleton<Master, ACE_Null_Mutex>::instance())
|
||||
#define sMaster ACE_Singleton<Master, ACE_Null_Mutex>::instance()
|
||||
#endif
|
||||
/// @}
|
||||
|
||||
@@ -61,23 +61,23 @@ RARunnable::~RARunnable()
|
||||
|
||||
void RARunnable::run()
|
||||
{
|
||||
if (!sConfig.GetBoolDefault("Ra.Enable", false))
|
||||
if (!sConfig->GetBoolDefault("Ra.Enable", false))
|
||||
return;
|
||||
|
||||
ACE_Acceptor<RASocket, ACE_SOCK_ACCEPTOR> acceptor;
|
||||
|
||||
uint16 raport = sConfig.GetIntDefault("Ra.Port", 3443);
|
||||
std::string stringip = sConfig.GetStringDefault("Ra.IP", "0.0.0.0");
|
||||
uint16 raport = sConfig->GetIntDefault("Ra.Port", 3443);
|
||||
std::string stringip = sConfig->GetStringDefault("Ra.IP", "0.0.0.0");
|
||||
|
||||
ACE_INET_Addr listen_addr(raport, stringip.c_str());
|
||||
|
||||
if (acceptor.open(listen_addr, m_Reactor) == -1)
|
||||
{
|
||||
sLog.outError("Trinity RA can not bind to port %d on %s", raport, stringip.c_str());
|
||||
sLog->outError("Trinity RA can not bind to port %d on %s", raport, stringip.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
sLog.outString("Starting Trinity RA on port %d on %s", raport, stringip.c_str());
|
||||
sLog->outString("Starting Trinity RA on port %d on %s", raport, stringip.c_str());
|
||||
|
||||
while (!World::IsStopped())
|
||||
{
|
||||
@@ -89,5 +89,5 @@ void RARunnable::run()
|
||||
break;
|
||||
}
|
||||
|
||||
sLog.outStaticDebug("Trinity RA thread exiting");
|
||||
sLog->outStaticDebug("Trinity RA thread exiting");
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
RASocket::RASocket()
|
||||
{
|
||||
iMinLevel = sConfig.GetIntDefault("RA.MinLevel", 3);
|
||||
iMinLevel = sConfig->GetIntDefault("RA.MinLevel", 3);
|
||||
}
|
||||
|
||||
RASocket::~RASocket()
|
||||
@@ -45,18 +45,18 @@ int RASocket::open(void *)
|
||||
|
||||
if (peer().get_remote_addr(remote_addr) == -1)
|
||||
{
|
||||
sLog.outError("RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno));
|
||||
sLog->outError("RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
sLog.outRemote("Incoming connection from %s", remote_addr.get_host_addr());
|
||||
sLog->outRemote("Incoming connection from %s", remote_addr.get_host_addr());
|
||||
|
||||
return activate();
|
||||
}
|
||||
|
||||
int RASocket::handle_close(ACE_HANDLE, ACE_Reactor_Mask)
|
||||
{
|
||||
sLog.outRemote("Closing connection");
|
||||
sLog->outRemote("Closing connection");
|
||||
peer().close_reader();
|
||||
wait();
|
||||
destroy();
|
||||
@@ -122,7 +122,7 @@ int RASocket::recv_line(std::string& out_line)
|
||||
|
||||
if (recv_line(message_block) == -1)
|
||||
{
|
||||
sLog.outRemote("Recv error %s", ACE_OS::strerror(errno));
|
||||
sLog->outRemote("Recv error %s", ACE_OS::strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ int RASocket::process_command(const std::string& command)
|
||||
if (command.length() == 0)
|
||||
return 0;
|
||||
|
||||
sLog.outRemote("Got command: %s", command.c_str());
|
||||
sLog->outRemote("Got command: %s", command.c_str());
|
||||
|
||||
// handle quit, exit and logout commands to terminate connection
|
||||
if (command == "quit" || command == "exit" || command == "logout") {
|
||||
@@ -145,7 +145,7 @@ int RASocket::process_command(const std::string& command)
|
||||
}
|
||||
|
||||
CliCommandHolder* cmd = new CliCommandHolder(this, command.c_str(), &RASocket::zprint, &RASocket::commandFinished);
|
||||
sWorld.QueueCliCommand(cmd);
|
||||
sWorld->QueueCliCommand(cmd);
|
||||
|
||||
// wait for result
|
||||
ACE_Message_Block* mb;
|
||||
@@ -183,7 +183,7 @@ int RASocket::check_access_level(const std::string& user)
|
||||
|
||||
if (!result)
|
||||
{
|
||||
sLog.outRemote("User %s does not exist in database", user.c_str());
|
||||
sLog->outRemote("User %s does not exist in database", user.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -191,12 +191,12 @@ int RASocket::check_access_level(const std::string& user)
|
||||
|
||||
if (fields[1].GetUInt32() < iMinLevel)
|
||||
{
|
||||
sLog.outRemote("User %s has no privilege to login", user.c_str());
|
||||
sLog->outRemote("User %s has no privilege to login", user.c_str());
|
||||
return -1;
|
||||
}
|
||||
else if (fields[2].GetInt32() != -1)
|
||||
{
|
||||
sLog.outRemote("User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str());
|
||||
sLog->outRemote("User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass)
|
||||
|
||||
if (!check)
|
||||
{
|
||||
sLog.outRemote("Wrong password for user: %s", user.c_str());
|
||||
sLog->outRemote("Wrong password for user: %s", user.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ int RASocket::authenticate()
|
||||
if (recv_line(pass) == -1)
|
||||
return -1;
|
||||
|
||||
sLog.outRemote("Login attempt for user: %s", user.c_str());
|
||||
sLog->outRemote("Login attempt for user: %s", user.c_str());
|
||||
|
||||
if (check_access_level(user) == -1)
|
||||
return -1;
|
||||
@@ -252,7 +252,7 @@ int RASocket::authenticate()
|
||||
if (check_password(user, pass) == -1)
|
||||
return -1;
|
||||
|
||||
sLog.outRemote("User login: %s", user.c_str());
|
||||
sLog->outRemote("User login: %s", user.c_str());
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ int RASocket::svc(void)
|
||||
}
|
||||
|
||||
// send motd
|
||||
if (send(std::string(sWorld.GetMotd()) + "\r\n") == -1)
|
||||
if (send(std::string(sWorld->GetMotd()) + "\r\n") == -1)
|
||||
return -1;
|
||||
|
||||
for(;;)
|
||||
@@ -304,7 +304,7 @@ void RASocket::zprint(void* callbackArg, const char * szText)
|
||||
|
||||
if (socket->putq(mb, const_cast<ACE_Time_Value*>(&ACE_Time_Value::zero)) == -1)
|
||||
{
|
||||
sLog.outRemote("Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno));
|
||||
sLog->outRemote("Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno));
|
||||
mb->release();
|
||||
}
|
||||
}
|
||||
@@ -325,7 +325,7 @@ void RASocket::commandFinished(void* callbackArg, bool /*success*/)
|
||||
if (socket->putq(mb) == -1)
|
||||
{
|
||||
// getting here is bad, command can't be marked as complete
|
||||
sLog.outRemote("Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno));
|
||||
sLog->outRemote("Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno));
|
||||
mb->release();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,18 +38,18 @@ void TCSoapRunnable::run()
|
||||
soap.send_timeout = 5;
|
||||
if (soap_bind(&soap, m_host.c_str(), m_port, 100) < 0)
|
||||
{
|
||||
sLog.outError("TCSoap: couldn't bind to %s:%d", m_host.c_str(), m_port);
|
||||
sLog->outError("TCSoap: couldn't bind to %s:%d", m_host.c_str(), m_port);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
sLog.outString("TCSoap: bound to http://%s:%d", m_host.c_str(), m_port);
|
||||
sLog->outString("TCSoap: bound to http://%s:%d", m_host.c_str(), m_port);
|
||||
|
||||
while(!World::IsStopped())
|
||||
{
|
||||
if (soap_accept(&soap) < 0)
|
||||
continue; // ran into an accept timeout
|
||||
|
||||
sLog.outDebug("TCSoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
|
||||
sLog->outDebug("TCSoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF);
|
||||
struct soap* thread_soap = soap_copy(&soap);// make a safe copy
|
||||
|
||||
ACE_Message_Block *mb = new ACE_Message_Block(sizeof(struct soap*));
|
||||
@@ -87,40 +87,40 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
|
||||
// security check
|
||||
if (!soap->userid || !soap->passwd)
|
||||
{
|
||||
sLog.outDebug("TCSoap: Client didn't provide login information");
|
||||
sLog->outDebug("TCSoap: Client didn't provide login information");
|
||||
return 401;
|
||||
}
|
||||
|
||||
uint32 accountId = sAccountMgr->GetId(soap->userid);
|
||||
if(!accountId)
|
||||
{
|
||||
sLog.outDebug("TCSoap: Client used invalid username '%s'", soap->userid);
|
||||
sLog->outDebug("TCSoap: Client used invalid username '%s'", soap->userid);
|
||||
return 401;
|
||||
}
|
||||
|
||||
if(!sAccountMgr->CheckPassword(accountId, soap->passwd))
|
||||
{
|
||||
sLog.outDebug("TCSoap: invalid password for account '%s'", soap->userid);
|
||||
sLog->outDebug("TCSoap: invalid password for account '%s'", soap->userid);
|
||||
return 401;
|
||||
}
|
||||
|
||||
if(sAccountMgr->GetSecurity(accountId) < SEC_ADMINISTRATOR)
|
||||
{
|
||||
sLog.outDebug("TCSoap: %s's gmlevel is too low", soap->userid);
|
||||
sLog->outDebug("TCSoap: %s's gmlevel is too low", soap->userid);
|
||||
return 403;
|
||||
}
|
||||
|
||||
if(!command || !*command)
|
||||
return soap_sender_fault(soap, "Command mustn't be empty", "The supplied command was an empty string");
|
||||
|
||||
sLog.outDebug("TCSoap: got command '%s'", command);
|
||||
sLog->outDebug("TCSoap: got command '%s'", command);
|
||||
SOAPCommand connection;
|
||||
|
||||
// commands are executed in the world thread. We have to wait for them to be completed
|
||||
{
|
||||
// CliCommandHolder will be deleted from world, accessing after queueing is NOT save
|
||||
CliCommandHolder* cmd = new CliCommandHolder(&connection, command, &SOAPCommand::print, &SOAPCommand::commandFinished);
|
||||
sWorld.QueueCliCommand(cmd);
|
||||
sWorld->QueueCliCommand(cmd);
|
||||
}
|
||||
|
||||
// wait for callback to complete command
|
||||
@@ -128,7 +128,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result)
|
||||
int acc = connection.pendingCommands.acquire();
|
||||
if(acc)
|
||||
{
|
||||
sLog.outError("TCSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno);
|
||||
sLog->outError("TCSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno);
|
||||
}
|
||||
|
||||
// alright, command finished
|
||||
|
||||
@@ -56,7 +56,7 @@ void WorldRunnable::run()
|
||||
|
||||
uint32 diff = getMSTimeDiff(realPrevTime,realCurrTime);
|
||||
|
||||
sWorld.Update( diff );
|
||||
sWorld->Update( diff );
|
||||
realPrevTime = realCurrTime;
|
||||
|
||||
// diff (D0) include time of previous sleep (d0) + tick time (t0)
|
||||
@@ -82,8 +82,8 @@ void WorldRunnable::run()
|
||||
|
||||
sScriptMgr->OnShutdown();
|
||||
|
||||
sWorld.KickAll(); // save and kick all players
|
||||
sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call
|
||||
sWorld->KickAll(); // save and kick all players
|
||||
sWorld->UpdateSessions( 1 ); // real players unload required UpdateSessions call
|
||||
|
||||
// unload battleground templates before different singletons destroyed
|
||||
sBattlegroundMgr->DeleteAllBattlegrounds();
|
||||
|
||||
Reference in New Issue
Block a user