本文整理汇总了C++中ACE_Sig_Handler类的典型用法代码示例。如果您正苦于以下问题:C++ ACE_Sig_Handler类的具体用法?C++ ACE_Sig_Handler怎么用?C++ ACE_Sig_Handler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ACE_Sig_Handler类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ACE_TMAIN
int ACE_TMAIN (int, ACE_TCHAR *[])
{
MySignalHandler sighandler;
ACE_Sig_Handler sh;
sh.register_handler (SIGUSR1, &sighandler);
ACE_Sig_Set ss;
ss.sig_add (SIGUSR1);
ACE_Sig_Guard guard (&ss);
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Entering critical region\n")));
ACE_OS::sleep (10);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Leaving critical region\n")));
}
// Do other stuff.
return 0;
}
示例2: ACE_TMAIN
// Listing 1
// Listing 2 code/ch11
int ACE_TMAIN (int, ACE_TCHAR *[])
{
MySignalHandler h1 (SIGUSR1), h2 (SIGUSR2);
ACE_Sig_Handler handler;
handler.register_handler (SIGUSR1, &h1);
handler.register_handler (SIGUSR2, &h2);
ACE_OS::kill (ACE_OS::getpid (), SIGUSR1);
ACE_OS::kill (ACE_OS::getpid (), SIGUSR2);
int time = 10;
while ((time = ACE_OS::sleep (time)) == -1)
{
if (errno == EINTR)
continue;
else
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("sleep")), -1);
}
}
return 0;
}
示例3: initSignal
//---------------------------------------------------------------------------
void initSignal(PasSignalHandler* pSignalHandler)
{
// 시그널 핸들러 셋팅
ACE_Sig_Handler* pSigHandler = new ACE_Sig_Handler;
// 시그널 핸들링
pSigHandler->register_handler(SIGINT, pSignalHandler);
pSigHandler->register_handler(SIGTERM, pSignalHandler);
pSigHandler->register_handler(SIGQUIT, pSignalHandler);
pSigHandler->register_handler(SIGUSR1, pSignalHandler);
pSigHandler->register_handler(SIGUSR2, pSignalHandler);
// 시그널 무시
pSigHandler->register_handler(SIGPIPE, pSignalHandler);
pSigHandler->register_handler(SIGALRM, pSignalHandler);
pSigHandler->register_handler(SIGHUP, pSignalHandler);
pSigHandler->register_handler(SIGCHLD, pSignalHandler);
}
示例4: main
//.........这里部分代码省略.........
// Get the list of realms for the server
sRealmList->Initialize(ConfigMgr::GetIntDefault("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "No valid realms specified.");
return 1;
}
// Launch the listening network socket
RealmAcceptor acceptor;
int32 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
if (rmport < 0 || rmport > 0xFFFF)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Specified port out of allowed range (1-65535)");
return 1;
}
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
ACE_INET_Addr bind_addr(uint16(rmport), bind_ip.c_str());
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport);
return 1;
}
// Initialise the signal handlers
AuthServerSignalHandler SignalINT, SignalTERM;
// Register authservers's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
///- Handle affinity for multiple processors and process priority on Windows
#ifdef _WIN32
{
HANDLE hProcess = GetCurrentProcess();
uint32 Aff = ConfigMgr::GetIntDefault("UseProcessors", 0);
if (Aff > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
{
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
if (!curAff)
sLog->outError(LOG_FILTER_AUTHSERVER, "Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff);
else if (SetProcessAffinityMask(hProcess, curAff))
sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using processors (bitmask, hex): %x", curAff);
else
sLog->outError(LOG_FILTER_AUTHSERVER, "Can't set used processors (hex): %x", curAff);
}
}
bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false);
if (Prio)
{
示例5: CreatePIDFile
/// Main function
int Master::Run()
{
BigNumber seed1;
seed1.SetRand(16 * 8);
sLog->outString("%s (worldserver-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");
/// worldserver PID file creation
std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");
if (!pidfile.empty())
{
uint32 pid = CreatePIDFile(pidfile);
if (!pid)
{
sLog->outError("Cannot create PID file %s.\n", pidfile.c_str());
return 1;
}
sLog->outString("Daemon PID: %u\n", pid);
}
///- Start the databases
if (!_StartDB())
return 1;
// set server offline (not connectable)
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = (flag & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID);
///- Initialize the World
sWorld->SetInitialWorldSettings();
// Initialise the signal handlers
WorldServerSignalHandler SignalINT, SignalTERM;
#ifdef _WIN32
WorldServerSignalHandler SignalBREAK;
#endif /* _WIN32 */
// Register worldserver's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
#ifdef _WIN32
Handler.register_handler(SIGBREAK, &SignalBREAK);
#endif /* _WIN32 */
///- Launch WorldRunnable thread
ACE_Based::Thread world_thread(new WorldRunnable);
world_thread.setPriority(ACE_Based::Highest);
ACE_Based::Thread* cliThread = NULL;
#ifdef _WIN32
if (ConfigMgr::GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
#else
if (ConfigMgr::GetBoolDefault("Console.Enable", true))
#endif
{
///- Launch CliRunnable thread
cliThread = new ACE_Based::Thread(new CliRunnable);
}
ACE_Based::Thread rar_thread(new RARunnable);
///- Handle affinity for multiple processors and process priority on Windows
#ifdef _WIN32
{
HANDLE hProcess = GetCurrentProcess();
uint32 Aff = ConfigMgr::GetIntDefault("UseProcessors", 0);
if (Aff > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
{
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
if (!curAff)
{
sLog->outError("Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff);
}
else
{
if (SetProcessAffinityMask(hProcess, curAff))
sLog->outString("Using processors (bitmask, hex): %x", curAff);
else
sLog->outError("Can't set used processors (hex): %x", curAff);
//.........这里部分代码省略.........
示例6: main
//.........这里部分代码省略.........
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)
{
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");
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);
return 1;
}
// Initialise the signal handlers
RealmdSignalHandler SignalINT, SignalTERM;
#ifdef _WIN32
RealmdSignalHandler SignalBREAK;
#endif /* _WIN32 */
// Register realmd's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
#ifdef _WIN32
Handler.register_handler(SIGBREAK, &SignalBREAK);
#endif /* _WIN32 */
///- Handle affinity for multiple processors and process priority on Windows
#ifdef _WIN32
{
HANDLE hProcess = GetCurrentProcess();
uint32 Aff = sConfig.GetIntDefault("UseProcessors", 0);
if (Aff > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
{
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
if (!curAff)
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);
else
sLog.outError("Can't set used processors (hex): %x", curAff);
}
sLog.outString();
}
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
示例7: main
//.........这里部分代码省略.........
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 (authserver realmid)
// Get the list of realms for the server
sRealmList->Initialize(sConfig->GetIntDefault("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
{
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");
ACE_INET_Addr bind_addr(rmport, bind_ip.c_str());
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
sLog->outError("ALiveCore2 LoginServer can not bind to %s:%d", bind_ip.c_str(), rmport);
return 1;
}
// Initialise the signal handlers
AuthServerSignalHandler SignalINT, SignalTERM;
// Register authservers's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
///- Handle affinity for multiple processors and process priority on Windows
#ifdef _WIN32
{
HANDLE hProcess = GetCurrentProcess();
uint32 Aff = sConfig->GetIntDefault("UseProcessors", 0);
if (Aff > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
{
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
if (!curAff)
sLog->outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff);
else if (SetProcessAffinityMask(hProcess, curAff))
sLog->outString("Using processors (bitmask, hex): %x", curAff);
else
sLog->outError("Can't set used processors (hex): %x", curAff);
}
sLog->outString();
}
bool Prio = sConfig->GetBoolDefault("ProcessPriority", false);
if (Prio)
{
示例8: TC_LOG_INFO
/// Main function
int Master::Run()
{
OpenSSLCrypto::threadsSetup();
BigNumber seed1;
seed1.SetRand(16 * 8);
TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon)", _FULLVERSION);
TC_LOG_INFO("server.worldserver", " ");
TC_LOG_INFO("server.worldserver", " A World of Warcraft Cataclsym 4.3.4 Emulator ");
TC_LOG_INFO("server.worldserver", " _/_/ _/ _/_/_/ _/_/ _/_/_/ _/_/_/_/ ");
TC_LOG_INFO("server.worldserver", " _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ ");
TC_LOG_INFO("server.worldserver", " _/_/_/_/ _/_/ _/_/ _/ _/ _/ _/_/_/ _/_/_/ ");
TC_LOG_INFO("server.worldserver", " _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ ");
TC_LOG_INFO("server.worldserver", " _/ _/ _/ _/ _/ _/_/_/ _/_/ _/ _/ _/_/_/_/ NG ");
TC_LOG_INFO("server.worldserver", " Arkania Community (c) 2017! <http://arkania.net/> ");
TC_LOG_INFO("server.worldserver", " ");
TC_LOG_INFO("server.worldserver", "<Ctrl-C> to stop.\n");
/// worldserver PID file creation
std::string pidFile = sConfigMgr->GetStringDefault("PidFile", "");
if (!pidFile.empty())
{
if (uint32 pid = CreatePIDFile(pidFile))
TC_LOG_INFO("server.worldserver", "Daemon PID: %u\n", pid);
else
{
TC_LOG_ERROR("server.worldserver", "Cannot create PID file %s.\n", pidFile.c_str());
return 1;
}
}
///- Start the databases
if (!_StartDB())
return 1;
// set server offline (not connectable)
LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = (flag & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID);
///- Initialize the World
sWorld->SetInitialWorldSettings();
///- Initialize the signal handlers
WorldServerSignalHandler signalINT, signalTERM;
#ifdef _WIN32
WorldServerSignalHandler signalBREAK;
#endif /* _WIN32 */
///- Register worldserver's signal handlers
ACE_Sig_Handler handle;
handle.register_handler(SIGINT, &signalINT);
handle.register_handler(SIGTERM, &signalTERM);
#ifdef _WIN32
handle.register_handler(SIGBREAK, &signalBREAK);
#endif
///- Launch WorldRunnable thread
ACE_Based::Thread worldThread(new WorldRunnable);
worldThread.setPriority(ACE_Based::Highest);
ACE_Based::Thread* cliThread = nullptr;
#ifdef _WIN32
if (sConfigMgr->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
#else
if (sConfigMgr->GetBoolDefault("Console.Enable", true))
#endif
{
///- Launch CliRunnable thread
cliThread = new ACE_Based::Thread(new CliRunnable);
}
ACE_Based::Thread rarThread(new RARunnable);
#if defined(_WIN32) || defined(__linux__)
///- Handle affinity for multiple processors and process priority
uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0);
bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false);
#ifdef _WIN32 // Windows
HANDLE hProcess = GetCurrentProcess();
if (affinity > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
{
ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors
if (!currentAffinity)
TC_LOG_ERROR("server.worldserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff);
else if (SetProcessAffinityMask(hProcess, currentAffinity))
TC_LOG_INFO("server.worldserver", "Using processors (bitmask, hex): %x", currentAffinity);
else
TC_LOG_ERROR("server.worldserver", "Can't set used processors (hex): %x", currentAffinity);
}
//.........这里部分代码省略.........
示例9: main
//.........这里部分代码省略.........
if (!StartDB())
return 1;
// Initialize the log database
sLogMgr->ResetLogDb();
sLogMgr->SetRealmId(0);
// Get the list of realms for the server
sRealmList->Initialize(ConfigMgr::GetIntDefault("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
{
sLogMgr->WriteLn(SERVER_LOG, LOGL_ERROR, "No valid realms specified.");
return 1;
}
// Launch the listening network socket
RealmAcceptor acceptor;
uint16 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
std::string bind_ip = ConfigMgr::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)
{
sLogMgr->WriteLn(SERVER_LOG, LOGL_ERROR, "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport);
return 1;
}
// Initialise the signal handlers
AuthServerSignalHandler SignalINT, SignalTERM;
// Register authservers's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
///- Handle affinity for multiple processors and process priority on Windows
#ifdef _WIN32
{
HANDLE hProcess = GetCurrentProcess();
uint32 Aff = ConfigMgr::GetIntDefault("UseProcessors", 0);
if (Aff > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
{
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
if (!curAff)
sLogMgr->WriteLn(SERVER_LOG, LOGL_ERROR, "Processors marked in UseProcessors bitmask (hex) %x not accessible for authserver. Accessible processors bitmask (hex): %x", Aff, appAff);
else if (SetProcessAffinityMask(hProcess, curAff))
sLogMgr->WriteLn(SERVER_LOG, LOGL_STRING, "Using processors (bitmask, hex): %x", curAff);
else
sLogMgr->WriteLn(SERVER_LOG, LOGL_ERROR, "Can't set used processors (hex): %x", curAff);
}
sLogMgr->WriteLn(SERVER_LOG, LOGL_STRING, std::string());
}
bool Prio = ConfigMgr::GetBoolDefault("ProcessPriority", false);
if (Prio)
{
示例10: main
//.........这里部分代码省略.........
// Get the list of realms for the server
sRealmList->Initialize(sConfigMgr->GetIntDefault("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
{
TC_LOG_ERROR("server.authserver", "No valid realms specified.");
return 1;
}
// Launch the listening network socket
RealmAcceptor acceptor;
int32 rmport = sConfigMgr->GetIntDefault("RealmServerPort", 3724);
if (rmport < 0 || rmport > 0xFFFF)
{
TC_LOG_ERROR("server.authserver", "Specified port out of allowed range (1-65535)");
return 1;
}
std::string bind_ip = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0");
ACE_INET_Addr bind_addr(uint16(rmport), bind_ip.c_str());
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
TC_LOG_ERROR("server.authserver", "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport);
return 1;
}
// Initialize the signal handlers
AuthServerSignalHandler SignalINT, SignalTERM;
// Register authservers's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
#if defined(_WIN32) || defined(__linux__)
///- Handle affinity for multiple processors and process priority
uint32 affinity = sConfigMgr->GetIntDefault("UseProcessors", 0);
bool highPriority = sConfigMgr->GetBoolDefault("ProcessPriority", false);
#ifdef _WIN32 // Windows
HANDLE hProcess = GetCurrentProcess();
if (affinity > 0)
{
ULONG_PTR appAff;
ULONG_PTR sysAff;
if (GetProcessAffinityMask(hProcess, &appAff, &sysAff))
{
// remove non accessible processors
ULONG_PTR currentAffinity = affinity & appAff;
if (!currentAffinity)
TC_LOG_ERROR("server.authserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff);
else if (SetProcessAffinityMask(hProcess, currentAffinity))
TC_LOG_INFO("server.authserver", "Using processors (bitmask, hex): %x", currentAffinity);
else
TC_LOG_ERROR("server.authserver", "Can't set used processors (hex): %x", currentAffinity);
}
}
if (highPriority)
示例11: CreatePIDFile
/// Main function
int Master::Run()
{
BigNumber seed1;
seed1.SetRand(16 * 8);
sLog->outString("%s (core-daemon)", _FULLVERSION);
sLog->outString("<Ctrl-C> to stop.\n");
/* Beginning Of PDS-4TC Badge*/ /* Added by Pryd inspired by Lorac */
sLog->outString(" . . . ");
sLog->outString(" . . ");
sLog->outString(" ____ . \\ / . ");
sLog->outString(" /\\ / \\ . - ^ - ");
sLog->outString(" \\ \\_ / . / | \\ . . ");
sLog->outString(" \\ \\\\ _ . ");
sLog->outString(" \\ \\\\ \\// _ _ /\\ __ ");
sLog->outString(" \\ \\\\ \\\\ \\\\ // /`'\\ \\__ \\ / ");
sLog->outString(" \\//__\\\\ \\\\// /____\\ \\__ \\/ ");
sLog->outString(" _____// ```````` ");
sLog->outString(" /\\ ___\\ PDS-CC-2010 ");
sLog->outString(" \\ \\ \\__/ ______ _ __ _____ ");
sLog->outString(" \\ \\ \\ /\\ __ \\/\\`'__\\/\\ __\\ ");
sLog->outString(" ,, \\ \\ \\___\\ \\ \\_\\ \\ \\ \\_/\\ \\ \\//_ ");
sLog->outString("_/\\_|_____\\ \\_____\\ \\_____\\ \\_\\ \\ \\____\\ ");
sLog->outString(" ` ` ` ` ` \\______/\\/_____/\\/_/ \\/____/ ");
sLog->outString(" ");
sLog->outString( "PDS-CC Core based on TrinityCore");
sLog->outString( "PDS Project Resource Locations");
sLog->outString( "Main: Http://prydevserver.com");
sLog->outString( "Repo: Http://sf.net/projects/prydevserver");
sLog->outString( "Forum: Http://prydevserver.com/ultracore/forum ");
sLog->outString( "PryDevServer.com Development for the Community");
/* End Of PDS-4TC Badge*/ /* Added by Pryd inspired by Lorac */
#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");
#endif //USE_SFMT_FOR_RNG
/// worldd PID file creation
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());
return 1;
}
sLog->outString("Daemon PID: %u\n", pid);
}
///- Start the databases
if (!_StartDB())
return 1;
// set server offline (not connectable)
LoginDatabase.DirectPExecute("UPDATE realmlist SET color = (color & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID);
///- Initialize the World
sWorld->SetInitialWorldSettings();
// Initialise the signal handlers
CoredSignalHandler SignalINT, SignalTERM;
#ifdef _WIN32
CoredSignalHandler SignalBREAK;
#endif /* _WIN32 */
// Register realmd's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
#ifdef _WIN32
Handler.register_handler(SIGBREAK, &SignalBREAK);
#endif /* _WIN32 */
///- Launch WorldRunnable thread
ACE_Based::Thread world_thread(new WorldRunnable);
world_thread.setPriority(ACE_Based::Highest);
ACE_Based::Thread* cliThread = NULL;
#ifdef _WIN32
if (sConfig->GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/)
#else
if (sConfig->GetBoolDefault("Console.Enable", true))
#endif
{
///- Launch CliRunnable thread
cliThread = new ACE_Based::Thread(new CliRunnable);
}
ACE_Based::Thread rar_thread(new RARunnable);
//.........这里部分代码省略.........