aboutsummaryrefslogtreecommitdiff
path: root/src/server/authserver/Main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/authserver/Main.cpp')
-rwxr-xr-xsrc/server/authserver/Main.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp
index 7f7d2e39561..9d9dbf1b450 100755
--- a/src/server/authserver/Main.cpp
+++ b/src/server/authserver/Main.cpp
@@ -88,7 +88,7 @@ class RealmdSignalHandler : public Trinity::SignalHandler
/// 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"
@@ -102,7 +102,7 @@ void usage(const char *prog)
/// Launch the realm server
extern int main(int argc, char **argv)
{
- sLog.SetLogDB(false);
+ sLog->SetLogDB(false);
///- Command line parsing to get the configuration file name
char const* cfg_file = _TRINITY_REALM_CONFIG;
int c=1;
@@ -112,7 +112,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;
}
@@ -128,25 +128,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;
}
@@ -160,19 +160,19 @@ 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 \'[authserver]\' 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 \'[authserver]\' written in the top of the file!");
return 1;
}
- sLog.Initialize();
+ sLog->Initialize();
- sLog.outString("%s (realm-daemon)", _FULLVERSION);
- sLog.outString("<Ctrl-C> to stop.\n");
- sLog.outString("Using configuration file %s.", cfg_file);
+ sLog->outString("%s (realm-daemon)", _FULLVERSION);
+ sLog->outString("<Ctrl-C> to stop.\n");
+ sLog->outString("Using configuration file %s.", cfg_file);
- sLog.outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
+ sLog->outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true);
@@ -180,20 +180,20 @@ extern int main(int argc, char **argv)
ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);
#endif
- sLog.outBasic("Max allowed open files is %d", ACE::max_handles());
+ sLog->outBasic("Max allowed open files is %d", ACE::max_handles());
/// realmd 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);
}
///- Initialize the database connection
@@ -201,29 +201,29 @@ extern int main(int argc, char **argv)
return 1;
///- Initialize the log database
- 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)
+ 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));
+ sRealmList->Initialize(sConfig->GetIntDefault("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
{
- sLog.outError("No valid realms specified.");
+ sLog->outError("No valid realms specified.");
return 1;
}
///- Launch the listening network socket
RealmAcceptor acceptor;
- uint16 rmport = sConfig.GetIntDefault("RealmServerPort", 3724);
- std::string bind_ip = sConfig.GetStringDefault("BindIP", "0.0.0.0");
+ uint16 rmport = sConfig->GetIntDefault("RealmServerPort", 3724);
+ std::string bind_ip = sConfig->GetStringDefault("BindIP", "0.0.0.0");
ACE_INET_Addr bind_addr(rmport, bind_ip.c_str());
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
- sLog.outError("Trinity realm can not bind to %s:%d", bind_ip.c_str(), rmport);
+ sLog->outError("Trinity realm can not bind to %s:%d", bind_ip.c_str(), rmport);
return 1;
}
@@ -246,7 +246,7 @@ extern int main(int argc, char **argv)
{
HANDLE hProcess = GetCurrentProcess();
- uint32 Aff = sConfig.GetIntDefault("UseProcessors", 0);
+ uint32 Aff = sConfig->GetIntDefault("UseProcessors", 0);
if (Aff > 0)
{
ULONG_PTR appAff;
@@ -258,46 +258,46 @@ extern int main(int argc, char **argv)
if (!curAff)
{
- sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for realmd. Accessible processors bitmask (hex): %x",Aff,appAff);
+ sLog->outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for realmd. 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)
{
if (SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
- sLog.outString("TrinityRealm process priority class set to HIGH");
+ sLog->outString("TrinityRealm process priority class set to HIGH");
else
- sLog.outError("Can't set realmd process priority class.");
- sLog.outString();
+ sLog->outError("Can't set realmd process priority class.");
+ sLog->outString();
}
}
#endif
// maximum counter for next ping
- uint32 numLoops = (sConfig.GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000));
+ uint32 numLoops = (sConfig->GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000));
uint32 loopCounter = 0;
// possibly enable db logging; avoid massive startup spam by doing it here.
- if (sLog.GetLogDBLater())
+ if (sLog->GetLogDBLater())
{
- sLog.outString("Enabling database logging...");
- sLog.SetLogDBLater(false);
+ sLog->outString("Enabling database logging...");
+ sLog->SetLogDBLater(false);
// login db needs thread for logging
- sLog.SetLogDB(true);
+ sLog->SetLogDB(true);
}
else
- sLog.SetLogDB(false);
+ sLog->SetLogDB(false);
///- Wait for termination signal
while (!stopEvent)
@@ -311,7 +311,7 @@ extern int main(int argc, char **argv)
if ((++loopCounter) == numLoops)
{
loopCounter = 0;
- sLog.outDetail("Ping MySQL to keep connection alive");
+ sLog->outDetail("Ping MySQL to keep connection alive");
LoginDatabase.KeepAlive();
}
#ifdef _WIN32
@@ -323,38 +323,38 @@ extern int main(int argc, char **argv)
///- Close the Database Pool
LoginDatabase.Close();
- sLog.outString("Halting process...");
+ sLog->outString("Halting process...");
return 0;
}
/// Initialize connection to the database
bool StartDB()
{
- std::string dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", "");
+ std::string dbstring = sConfig->GetStringDefault("LoginDatabaseInfo", "");
if (dbstring.empty())
{
- sLog.outError("Database not specified");
+ sLog->outError("Database not specified");
return false;
}
- uint8 worker_threads = sConfig.GetIntDefault("LoginDatabase.WorkerThreads", 1);
+ uint8 worker_threads = sConfig->GetIntDefault("LoginDatabase.WorkerThreads", 1);
if (worker_threads < 1 || worker_threads > 32)
{
- sLog.outError("Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1.");
+ sLog->outError("Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1.");
worker_threads = 1;
}
- uint8 synch_threads = sConfig.GetIntDefault("LoginDatabase.SynchThreads", 1);
+ uint8 synch_threads = sConfig->GetIntDefault("LoginDatabase.SynchThreads", 1);
if (synch_threads < 1 || synch_threads > 32)
{
- sLog.outError("Improper value specified for LoginDatabase.SynchThreads, defaulting to 1.");
+ sLog->outError("Improper value specified for LoginDatabase.SynchThreads, defaulting to 1.");
synch_threads = 1;
}
/// NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever.
if (!LoginDatabase.Open(dbstring.c_str(), worker_threads, synch_threads))
{
- sLog.outError("Cannot connect to database");
+ sLog->outError("Cannot connect to database");
return false;
}