您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CreatePIDFile函数代码示例

51自学网 2021-06-01 20:14:52
  C++
这篇教程C++ CreatePIDFile函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CreatePIDFile函数的典型用法代码示例。如果您正苦于以下问题:C++ CreatePIDFile函数的具体用法?C++ CreatePIDFile怎么用?C++ CreatePIDFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CreatePIDFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

//.........这里部分代码省略.........    ///- Check the version of the configuration file    uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);    if (confVersion < _REALMDCONFVERSION)    {        sLog.outError("*****************************************************************************");        sLog.outError(" WARNING: Your realmd.conf version indicates your conf file is out of date!");        sLog.outError("          Please check for updates, as your current default values may cause");        sLog.outError("          strange behavior.");        sLog.outError("*****************************************************************************");        Log::WaitBeforeContinueIfNeed();    }    DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));    if (SSLeay() < 0x009080bfL)    {        DETAIL_LOG("WARNING: Outdated version of OpenSSL lib. Logins to server may not work!");        DETAIL_LOG("WARNING: Minimal required version [OpenSSL 0.9.8k]");    }    DETAIL_LOG("Using ACE: %s", ACE_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);#else    ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);#endif    sLog.outBasic("Max allowed open files is %d", ACE::max_handles());    /// realmd 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());            Log::WaitBeforeContinueIfNeed();            return 1;        }        sLog.outString("Daemon PID: %u/n", pid);    }    ///- Initialize the database connection    if (!StartDB())    {        Log::WaitBeforeContinueIfNeed();        return 1;    }    ///- Get the list of realms for the server    sRealmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));    if (sRealmList.size() == 0)    {        sLog.outError("No valid realms specified.");        Log::WaitBeforeContinueIfNeed();        return 1;    }    // cleanup query    // set expired bans to inactive    LoginDatabase.BeginTransaction();    LoginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");    LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");    LoginDatabase.CommitTransaction();
开发者ID:Ariathies,项目名称:server,代码行数:67,


示例2: CreatePIDFile

// Main functionint Master::Run(){    sLog.outString("%s [core-daemon]", _FULLVERSION);    sLog.outString("<Ctrl-C> to stop.");    sLog.outString(" ");    sLog.outString("              BBBBBB                BBB     ");    sLog.outString("          BBBB:..:::BB        BBBBBBBBB     ");    sLog.outString("         B:::::BBB:::B      BB:....:::B     ");    sLog.outString("          BB:::B BB::B     B:::BBBB:::B     ");    sLog.outString("           B:::B BB:.B    B:::B    BB.:B    ");    sLog.outString("           B:::BBB::BBB  BB::B      BB.B    ");    sLog.outString("           B.:..BBB....BBB.:.B              ");    sLog.outString("           B...BB  BB..:BB...B              ");    sLog.outString("           B...B    B..:BB...B              ");    sLog.outString("           B...B    B..BBB...B              ");    sLog.outString("           B...B   BB.BBBB...B              ");    sLog.outString("           B...B BB:.BB  B...BB             ");    sLog.outString("          B: . B. :BB     B . B        BBB  ");    sLog.outString("         B: ..:BBBB       B:  .B      BB .B ");    sLog.outString("          BBBBB            B.  :B     B.: B ");    sLog.outString("                            B.  :BB    BB:BB");    sLog.outString("     BlizzLikeCore 2012(c)   BB   BBBBBBB B ");    sLog.outString("  <blizzlike.servegame.com>    BBB.    .BB  ");    sLog.outString("                                 BBBBBBBB   ");    sLog.outString(" ");    // 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;    // Initialize the World    sWorld.SetInitialWorldSettings();    // Catch termination signals    _HookSignals();    // Launch WorldRunnable thread    ACE_Based::Thread world_thread(new WorldRunnable);    world_thread.setPriority(ACE_Based::Highest);    // set realmbuilds depend on BlizzLikeCore expected builds, and set server online    std::string builds = AcceptableClientBuildsListStr();    LoginDatabase.escape_string(builds);    LoginDatabase.PExecute("UPDATE realmlist SET realmflags = realmflags & ~(%u), population = 0, realmbuilds = '%s'  WHERE id = '%d'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);    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);    // 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 BlizzLikeCore. 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);                }//.........这里部分代码省略.........
开发者ID:Amara1231,项目名称:blizzlikecore,代码行数:101,


示例3: TC_LOG_INFO

/// Main functionint Master::Run(){    OpenSSLCrypto::threadsSetup();    BigNumber seed1;    seed1.SetRand(16 * 8);    TC_LOG_INFO("server.worldserver", "%s (worldserver-daemon)", _FULLVERSION);    TC_LOG_INFO("server.worldserver", "<Ctrl-C> to stop./n");    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", "    // // // // /// // // ///// ///// // // // // //_// // //_// //");    TC_LOG_INFO("server.worldserver", "     // //_// //_//  // //_// //_// //_// //_// //__/////`____ //");    TC_LOG_INFO("server.worldserver", "      ///_////_/   ///_////_////_////_////__/ `/___/> //");    TC_LOG_INFO("server.worldserver", "                                 C O R E  ///___/");    TC_LOG_INFO("server.worldserver", "http://TrinityCore.org                    ///__//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 = NULL;#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);//.........这里部分代码省略.........
开发者ID:BillytheOrc,项目名称:TrinityCore,代码行数:101,


示例4: main

//.........这里部分代码省略.........        return 1;    }    sLog.Initialize();    sLog.outString( "%s [realm-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) );    sLog.outString( "<Ctrl-C> to stop./n" );    sLog.outString("Using configuration file %s.", cfg_file);    ///- Check the version of the configuration file    uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);    if (confVersion < _REALMDCONFVERSION)    {        sLog.outError("*****************************************************************************");        sLog.outError(" WARNING: Your realmd.conf version indicates your conf file is out of date!");        sLog.outError("          Please check for updates, as your current default values may cause");        sLog.outError("          strange behavior.");        sLog.outError("*****************************************************************************");        clock_t pause = 3000 + clock();        while (pause > clock()) {}    }    sLog.outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));    if (SSLeay() < 0x009080bfL )    {        sLog.outDetail("WARNING: Outdated version of OpenSSL lib. Logins to server impossible!");        sLog.outDetail("WARNING: Minimal required version [OpenSSL 0.9.8k]");    }    /// realmd 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 );    }    ///- Initialize the database connection    std::string dbstring;    if(!StartDB(dbstring))        return 1;    ///- Get the list of realms for the server    m_realmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));    if (m_realmList.size() == 0)    {        sLog.outError("No valid realms specified.");        return 1;    }    ///- Launch the listening network socket    port_t rmport = sConfig.GetIntDefault( "RealmServerPort", DEFAULT_REALMSERVER_PORT );    std::string bind_ip = sConfig.GetStringDefault("BindIP", "0.0.0.0");    SocketHandler h;    ListenSocket<AuthSocket> authListenSocket(h);    if ( authListenSocket.Bind(bind_ip.c_str(),rmport))    {        sLog.outError( "MaNGOS realmd can not bind to %s:%d",bind_ip.c_str(), rmport );        return 1;
开发者ID:bobazrh,项目名称:Bobaz-RH,代码行数:67,


示例5: main

/// Launch the auth serverextern int main(int argc, char **argv){    // Command line parsing to get the configuration file name    char const* cfg_file = _TRINITY_REALM_CONFIG;    int c = 1;    while (c < argc)    {        if (strcmp(argv[c], "-c") == 0)        {            if (++c >= argc)            {                printf("Runtime-Error: -c option requires an input argument/n");                usage(argv[0]);                return 1;            }            else                cfg_file = argv[c];        }        ++c;    }    if (!ConfigMgr::Load(cfg_file))    {        printf("Invalid or missing configuration file : %s/n", cfg_file);        printf("Verify that the file exists and has /'[authserver]/' written in the top of the file!/n");        return 1;    }    sLog->outInfo(LOG_FILTER_AUTHSERVER, "%s (authserver)", _FULLVERSION);    sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using configuration file %s.", cfg_file);    sLog->outWarn(LOG_FILTER_AUTHSERVER, "%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);#else    ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);#endif    sLog->outDebug(LOG_FILTER_AUTHSERVER, "Max allowed open files is %d", ACE::max_handles());    // authserver PID file creation    std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");    if (!pidfile.empty())    {        uint32 pid = CreatePIDFile(pidfile);        if (!pid)        {            sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s./n", pidfile.c_str());            return 1;        }        sLog->outInfo(LOG_FILTER_AUTHSERVER, "Daemon PID: %u/n", pid);    }    // Initialize the database connection    if (!StartDB())        return 1;    sLog->SetRealmID(0);                                               // ensure we've set realm to 0 (authserver realmid)    // 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    {//.........这里部分代码省略.........
开发者ID:BananaVodka,项目名称:TrinityCore,代码行数:101,


示例6: CreatePIDFile

/// Main functionint Master::Run(){    BigNumber seed1;    seed1.SetRand(16 * 8);    sLog->outInfo(LOG_FILTER_WORLDSERVER, "%s (worldserver-daemon)", _FULLVERSION);    sLog->outInfo(LOG_FILTER_WORLDSERVER, "<Ctrl-C> to stop./n");    sLog->outInfo(LOG_FILTER_WORLDSERVER, " _    _       _    _ _____                          ");    sLog->outInfo(LOG_FILTER_WORLDSERVER, "| |  | |     | |  | /  ___|                         ");    sLog->outInfo(LOG_FILTER_WORLDSERVER, "| |  | | ___ | |  | // `--.  ___  _   _ _ __ ___ ___ ");    sLog->outInfo(LOG_FILTER_WORLDSERVER, "| |///| |/ _ //| |///| |`--. /// _ //| | | | '__/ __/ _ //");    sLog->outInfo(LOG_FILTER_WORLDSERVER, "//  ///  / (_) //  ///  ///__/ / (_) | |_| | | | (_|  __/");    sLog->outInfo(LOG_FILTER_WORLDSERVER, " ///  /// //___/ ///  /////____/ //___/ //__,_|_|  //___//___|");    sLog->outInfo(LOG_FILTER_WORLDSERVER, "TrinityCore 2012-2015");    sLog->outInfo(LOG_FILTER_WORLDSERVER, "Visit our forum www.TrinityCore.info");    sLog->outInfo(LOG_FILTER_WORLDSERVER, "TrinityCore V3 Mop 5.4.8");    /// worldserver PID file creation    std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");    if (!pidfile.empty())    {        uint32 pid = CreatePIDFile(pidfile);        if (!pid)        {            sLog->outError(LOG_FILTER_WORLDSERVER, "Cannot create PID file %s./n", pidfile.c_str());            return 1;        }        sLog->outInfo(LOG_FILTER_WORLDSERVER, "Daemon PID: %u/n", pid);    }    ///- Start the databases    if (!_StartDB())        return 1;    ///- 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 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(LOG_FILTER_WORLDSERVER, "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->outInfo(LOG_FILTER_WORLDSERVER, "Using processors (bitmask, hex): %x", curAff);                    else                        sLog->outError(LOG_FILTER_WORLDSERVER, "Can't set used processors (hex): %x", curAff);                }            }        }//.........这里部分代码省略.........
开发者ID:cooler-SAI,项目名称:5.4.8-most-playable-source,代码行数:101,


示例7: main

/// Launch the realm serverextern int main(int argc, char **argv) {	sLog->SetLogDB(false);	///- Command line parsing to get the configuration file name			char const* cfg_file = _ARKCORE_REALM_CONFIG;			int c = 1;			while(c < argc)			{				if (strcmp(argv[c], "-c") == 0)				{					if (++c >= argc)					{						sLog->outError("Runtime-Error: -c option requires an input argument");						usage(argv[0]);						return 1;					}					else					cfg_file = argv[c];				}#ifdef _WIN32			////////////			//Services//			////////////			if (strcmp(argv[c], "-s") == 0)			{				if (++c >= argc)				{					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");					return 1;				}				else if (strcmp(argv[c], "uninstall") == 0)				{					if (WinServiceUninstall())					sLog->outString("Uninstalling service");					return 1;				}				else				{					sLog->outError("Runtime-Error: unsupported option %s", argv[c]);					usage(argv[0]);					return 1;				}			}			if (strcmp(argv[c], "--service") == 0)			WinServiceRun();#endif			++c;		}		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!");			return 1;		}		sLog->Initialize();		sLog->outString("%s (realm-daemon)", _CLIENT_BUILD_REVISION);		sLog->outString(" ");		sLog->outString("World of Warcraft: Mists of Pandaria");		sLog->outString("							Server emulator");		sLog->outString("This core is based on ArkCORE source.");		sLog->outString(" ");		sLog->outString("<Ctrl-C> to stop./n");		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);#else			ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);#endif			sLog->outBasic("Max allowed open files is %d", ACE::max_handles());			/// realmd 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);			}//.........这里部分代码省略.........
开发者ID:hodobaj,项目名称:Mists-EMU,代码行数:101,


示例8: main

//.........这里部分代码省略.........        }    }#endif    sLog.Initialize();    sLog.outString("%s [realm-daemon]", _FULLVERSION(REVISION_DATE, REVISION_TIME, REVISION_ID));    sLog.outString("<Ctrl-C> to stop./n");    sLog.outString("Using configuration file %s.", configFile.c_str());    ///- Check the version of the configuration file    uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);    if (confVersion < _REALMDCONFVERSION)    {        sLog.outError("*****************************************************************************");        sLog.outError(" WARNING: Your realmd.conf version indicates your conf file is out of date!");        sLog.outError("          Please check for updates, as your current default values may cause");        sLog.outError("          strange behavior.");        sLog.outError("*****************************************************************************");        Log::WaitBeforeContinueIfNeed();    }    DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));    if (SSLeay() < 0x009080bfL)    {        DETAIL_LOG("WARNING: Outdated version of OpenSSL lib. Logins to server may not work!");        DETAIL_LOG("WARNING: Minimal required version [OpenSSL 0.9.8k]");    }    /// realmd 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());            Log::WaitBeforeContinueIfNeed();            return 1;        }        sLog.outString("Daemon PID: %u/n", pid);    }    ///- Initialize the database connection    if (!StartDB())    {        Log::WaitBeforeContinueIfNeed();        return 1;    }    ///- Get the list of realms for the server    sRealmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));    if (sRealmList.size() == 0)    {        sLog.outError("No valid realms specified.");        Log::WaitBeforeContinueIfNeed();        return 1;    }    // cleanup query    // set expired bans to inactive    LoginDatabase.BeginTransaction();    LoginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");    LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");    LoginDatabase.CommitTransaction();
开发者ID:krullgor,项目名称:mangos-tbc,代码行数:67,


示例9: CreatePIDFile

/// Main functionint Master::Run(){    /// 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());            Log::WaitBeforeContinueIfNeed();            return 1;        }        sLog.outString("Daemon PID: %u/n", pid);    }    ///- Start the databases    if (!_StartDB())    {        Log::WaitBeforeContinueIfNeed();        return 1;    }    ///- Initialize the World    sWorld.SetInitialWorldSettings();#ifndef _WIN32    detachDaemon();#endif    // server loaded successfully => enable async DB requests    // this is done to forbid any async transactions during server startup!    CharacterDatabase.AllowAsyncTransactions();    WorldDatabase.AllowAsyncTransactions();    LoginDatabase.AllowAsyncTransactions();    ///- Catch termination signals    _HookSignals();    ///- Launch WorldRunnable thread    MaNGOS::Thread world_thread(new WorldRunnable);    world_thread.setPriority(MaNGOS::Priority_Highest);    // set realmbuilds depend on mangosd expected builds, and set server online    {        std::string builds = AcceptableClientBuildsListStr();        LoginDatabase.escape_string(builds);        LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags & ~(%u), population = 0, realmbuilds = '%s'  WHERE id = '%u'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);    }    MaNGOS::Thread* cliThread = nullptr;#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 MaNGOS::Thread(new CliRunnable);    }    ///- 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 mangosd. 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 && (m_ServiceStatus == -1)/* need set to default process priority class in service mode*/)        if (Prio)        {            if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))                sLog.outString("mangosd process priority class set to HIGH");//.........这里部分代码省略.........
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:101,


示例10: __

int Master::Run(){	sLog.outString("   ___     _                   _         ___                   ");    sLog.outString("  / _ //   | |_   ___   _ __   (_)  __   / __|  ___   _ _   ___ ");    sLog.outString(" / /_// //  |  _| / _ // | '  //  | | / _| | (__  / _ // | '_| / -_)");    sLog.outString("/_/   //_//  //__| //___/ |_|_|_| |_| //__|  //___| //___/ |_|   //___|");    sLog.outString("");    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);    }    if (!_StartDB())        return 1;    sWorld.SetInitialWorldSettings();    _HookSignals();    ACE_Based::Thread world_thread(new WorldRunnable);    world_thread.setPriority(ACE_Based::Highest);    std::string builds = AcceptableClientBuildsListStr();    LoginDatabase.escape_string(builds);    LoginDatabase.PExecute("UPDATE realmlist SET flag = flag & ~(%u), population = 0, gamebuild = '%s'  WHERE id = '%d'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);    ACE_Based::Thread* cliThread = NULL;#ifdef _WIN32    if (sConfig.GetBoolDefault("Console.Enable", true) && (m_ServiceStatus == -1))#else    if (sConfig.GetBoolDefault("Console.Enable", true))#endif    {        cliThread = new ACE_Based::Thread(new CliRunnable);    }    ACE_Based::Thread rar_thread(new RARunnable);    #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;                if (!curAff)                {                    sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for OregonCore. 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)        {            if (SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))                sLog.outString("OregonCore process priority class set to HIGH");            else                sLog.outError("ERROR: Can't set OregonCore process priority class.");            sLog.outString();        }    }    #endif    ACE_Based::Thread* soap_thread = NULL;    if (sConfig.GetBoolDefault("SOAP.Enabled", false))    {        OCSoapRunnable* soapconnectector = new OCSoapRunnable();        soapconnectector->setListenArguments(sConfig.GetStringDefault("SOAP.IP", "127.0.0.1"), uint16(sConfig.GetIntDefault("SOAP.Port", 7878)));        soap_thread = new ACE_Based::Thread(soapconnectector);    }    ACE_Based::Thread* freeze_thread = NULL;    if (uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0))    {        FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();        fdr->SetDelayTime(freeze_delay*1000);//.........这里部分代码省略.........
开发者ID:Anonymus123,项目名称:AtomicCore-2.4.3,代码行数:101,


示例11: main

//.........这里部分代码省略.........    sLog.outString("%s [realm-daemon]", _FULLVERSION(REVISION_DATE, REVISION_TIME, REVISION_NR, REVISION_ID));    sLog.outString("<Ctrl-C> to stop./n");    sLog.outString("Using configuration file %s.", cfg_file);    ///- Check the version of the configuration file    uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);    if (confVersion < _REALMDCONFVERSION)    {        sLog.outError("*****************************************************************************");        sLog.outError(" WARNING: Your realmd.conf version indicates your conf file is out of date!");        sLog.outError("          Please check for updates, as your current default values may cause");        sLog.outError("          strange behavior.");        sLog.outError("*****************************************************************************");        Log::WaitBeforeContinueIfNeed();    }    DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));    if (SSLeay() < 0x009080bfL)    {        DETAIL_LOG("WARNING: Outdated version of OpenSSL lib. Logins to server may not work!");        DETAIL_LOG("WARNING: Minimal required version [OpenSSL 0.9.8k]");    }    DETAIL_LOG("Using ACE: %s", ACE_VERSION);    DETAIL_LOG("Using BOOST: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);    sLog.outBasic("Max allowed open files is %d", boost::asio::socket_base::max_connections);    /// realmd 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());            Log::WaitBeforeContinueIfNeed();            return 1;        }        sLog.outString("Daemon PID: %u/n", pid);    }    ///- Initialize the database connection    if (!StartDB())    {        Log::WaitBeforeContinueIfNeed();        return 1;    }    ///- Get the list of realms for the server    sRealmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));    if (sRealmList.size() == 0)    {        sLog.outError("No valid realms specified.");        Log::WaitBeforeContinueIfNeed();        return 1;    }    // cleanup query    // set expired bans to inactive    LoginDatabase.BeginTransaction();    LoginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");    LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");    LoginDatabase.CommitTransaction();
开发者ID:Chaplain,项目名称:mangos-boost,代码行数:67,


示例12: main

// Launch the warden serverextern int main(int argc, char **argv){    // Command line parsing to get the configuration file name    char const* cfg_file = _wardenserver_CONFIG;    int c = 1;    while(c < argc)    {        if (strcmp(argv[c], "-c") == 0)        {            if (++c >= argc)            {                sLog->outError("Runtime-Error: -c option requires an input argument");                usage(argv[0]);                return 1;            }            else                cfg_file = argv[c];        }        ++c;    }    if (!sConfig->SetSource(cfg_file))    {        sLog->outError("Invalid or missing configuration file : %s", cfg_file);        sLog->outError("Verify that the file exists and has /'[wardenserver]/' written in the top of the file!");        return 1;    }    sLog->Initialize();    sLog->outString("%s (warden-daemon)", _FULLVERSION);    sLog->outString("<Ctrl-C> to stop./n");    sLog->outString("Using configuration file %s.", cfg_file);	sLog->outDetail("Using ACE: %s", ACE_VERSION);    ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);    sLog->outBasic("Max allowed open files is %d", ACE::max_handles());    // wardenserver 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);    }    // Launch the listening network socket    ACE_Acceptor<WardenSocket, ACE_SOCK_Acceptor> acceptor;    uint16 rmport = sConfig->GetIntDefault("WardenServerPort", 4321);    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("wardenserver can not bind to %s:%d", bind_ip.c_str(), rmport);        return 1;    }    // 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 Warden. 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)        {            if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))                sLog->outString("warden process priority class is set to HIGH");            else//.........这里部分代码省略.........
开发者ID:Bootz,项目名称:Stage6JUNK,代码行数:101,


示例13: CreatePIDFile

/// Main functionint Master::Run(){    /// worldd PID file creation    std::string pidfile = sConfig.GetStringDefault("PidFile", "");    if (!pidfile.empty())    {        uint32 pid = CreatePIDFile(pidfile);        if (!pid)        {            sLog.outError("Can not create PID file %s./n", pidfile.c_str());            Log::WaitBeforeContinueIfNeed();            return 1;        }        sLog.outString("Daemon PID: %u/n", pid);    }    ///- Start the databases    if (!_StartDB())    {        Log::WaitBeforeContinueIfNeed();        return 1;    }    ///- Set Realm to Offline, if crash happens. Only used once.    LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags | %u WHERE id = '%u'", REALM_FLAG_OFFLINE, realmID);    ///- Initialize the World    sWorld.SetInitialWorldSettings();#ifndef WIN32    detachDaemon();#endif    // server loaded successfully => enable async DB requests    // this is done to forbid any async transactions during server startup!    CharacterDatabase.AllowAsyncTransactions();    WorldDatabase.AllowAsyncTransactions();    LoginDatabase.AllowAsyncTransactions();    ///- Catch termination signals    _HookSignals();    ///- Launch WorldRunnable thread    ACE_Based::Thread world_thread(new WorldRunnable);    world_thread.setPriority(ACE_Based::Highest);    // set realmbuilds depend on mangosd expected builds, and set server online    {        std::string builds = AcceptableClientBuildsListStr();        LoginDatabase.escape_string(builds);        LoginDatabase.DirectPExecute("UPDATE realmlist SET realmflags = realmflags & ~(%u), population = 0, realmbuilds = '%s'  WHERE id = '%u'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);    }    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 = NULL;    if (sConfig.GetBoolDefault("Ra.Enable", false))    {        rar_thread = new ACE_Based::Thread(new RARunnable);    }    ///- 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 mangosd. 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();//.........这里部分代码省略.........
开发者ID:huodianyan,项目名称:server,代码行数:101,


示例14: main

//.........这里部分代码省略.........    sLog.outString( "%s [realm-daemon]", _FULLVERSION);    sLog.outString( "<Ctrl-C> to stop./n" );    sLog.outString("Using configuration file %s.", cfg_file);    // Check the version of the configuration file    uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);    if (confVersion < _REALMDCONFVERSION)    {        sLog.outError("*****************************************************************************");        sLog.outError(" WARNING: Your oregonrealm.conf version indicates your conf file is out of date!");        sLog.outError("          Please check for updates, as your current default values may cause");        sLog.outError("          strange behavior.");        sLog.outError("*****************************************************************************");        clock_t pause = 3000 + clock();        while (pause > clock()) {}    }    sLog.outDetail("Using ACE: %s", ACE_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);#else    ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);#endif    sLog.outBasic("Max allowed open files is %d", ACE::max_handles());    // realmd 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 );    }    // Initialize the database connection    if (!StartDB())        return 1;    // 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;    }    // cleanup query    // set expired bans to inactive    LoginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");    LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");    // Launch the listening network socket    ACE_Acceptor<AuthSocket, ACE_SOCK_Acceptor> acceptor;    uint16 rmport = sConfig.GetIntDefault("RealmServerPort", DEFAULT_REALMSERVER_PORT);    std::string bind_ip = sConfig.GetStringDefault("BindIP", "0.0.0.0");
开发者ID:Anonymus123,项目名称:AtomicCore-2.4.3,代码行数:66,


示例15: CreatePIDFile

/// Main functionint Master::Run(){    /// 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;    ///- Initialize the World    sWorld.SetInitialWorldSettings();    ///- Catch termination signals    _HookSignals();    ///- Launch WorldRunnable thread    ACE_Based::Thread world_thread(new WorldRunnable);    world_thread.setPriority(ACE_Based::Highest);    // set server online    loginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0 WHERE id = '%d'",realmID);    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);    ///- 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 mangosd. 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 && (m_ServiceStatus == -1)/* need set to default process priority class in service mode*/)        if(Prio)        {            if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))                sLog.outString("mangosd process priority class set to HIGH");            else                sLog.outError("ERROR: Can't set mangosd process priority class.");            sLog.outString();        }    }#endif    uint32 realCurrTime, realPrevTime;    realCurrTime = realPrevTime = getMSTime();    ///- Start up freeze catcher thread    if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0))    {        FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable();        fdr->SetDelayTime(freeze_delay*1000);//.........这里部分代码省略.........
开发者ID:Girosz,项目名称:mangos,代码行数:101,


示例16: main

/// Launch the auth serverextern int main(int argc, char** argv){    // Command line parsing to get the configuration file name    char const* configFile = _TRINITY_REALM_CONFIG;    int count = 1;    while (count < argc)    {        if (strcmp(argv[count], "-c") == 0)        {            if (++count >= argc)            {                printf("Runtime-Error: -c option requires an input argument/n");                usage(argv[0]);                return 1;            }            else                configFile = argv[count];        }        ++count;    }    if (!sConfigMgr->LoadInitial(configFile))    {        printf("Invalid or missing configuration file : %s/n", configFile);        printf("Verify that the file exists and has /'[authserver]/' written in the top of the file!/n");        return 1;    }    TC_LOG_INFO("server.authserver", "%s (authserver)", _FULLVERSION);    TC_LOG_INFO("server.authserver", " ");    TC_LOG_INFO("server.authserver", " A World of Warcraft Cataclsym 4.3.4 Emulator    ");    TC_LOG_INFO("server.authserver", "       _/_/              _/          _/_/_/    _/_/    _/_/_/    _/_/_/_/  ");    TC_LOG_INFO("server.authserver", "    _/    _/  _/  _/_/  _/  _/    _/        _/    _/  _/    _/  _/         ");    TC_LOG_INFO("server.authserver", "   _/_/_/_/  _/_/      _/_/      _/        _/    _/  _/_/_/    _/_/_/      ");    TC_LOG_INFO("server.authserver", "  _/    _/  _/        _/  _/    _/        _/    _/  _/    _/  _/           ");    TC_LOG_INFO("server.authserver", " _/    _/  _/        _/    _/    _/_/_/    _/_/    _/    _/  _/_/_/_/      ");    TC_LOG_INFO("server.authserver", " Arkania Community (c) 2014!");    TC_LOG_INFO("server.authserver", "      <http://arkania.net/>");    TC_LOG_INFO("server.authserver", " ");        TC_LOG_INFO("server.authserver", "<Ctrl-C> to stop./n");    TC_LOG_INFO("server.authserver", "Using configuration file %s.", configFile);    TC_LOG_INFO("server.authserver", "%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);#else    ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);#endif    TC_LOG_DEBUG("server.authserver", "Max allowed open files is %d", ACE::max_handles());    // authserver PID file creation    std::string pidFile = sConfigMgr->GetStringDefault("PidFile", "");    if (!pidFile.empty())    {        if (uint32 pid = CreatePIDFile(pidFile))            TC_LOG_INFO("server.authserver", "Daemon PID: %u/n", pid);        else        {            TC_LOG_ERROR("server.authserver", "Cannot create PID file %s./n", pidFile.c_str());            return 1;        }    }    // Initialize the database connection    if (!StartDB())        return 1;    // 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;//.........这里部分代码省略.........
开发者ID:redlaine,项目名称:InfinityCore-Ark,代码行数:101,


示例17: Community

/// Main functionint Master::Run() {	BigNumber seed1;	seed1.SetRand(16 * 8);	sLog->outString("%s (worldserver-daemon)", _CLIENT_BUILD_REVISION);			sLog->outString(" ");			sLog->outString(" 							A World of Warcraft: Cataclysm Core Emulator	");			sLog->outString("       _/_/              _/          _/_/_/    _/_/    _/_/_/    _/_/_/_/  ");			sLog->outString("    _/    _/  _/  _/_/  _/  _/    _/        _/    _/  _/    _/  _/         ");			sLog->outString("   _/_/_/_/  _/_/      _/_/      _/        _/    _/  _/_/_/    _/_/_/      ");			sLog->outString("  _/    _/  _/        _/  _/    _/        _/    _/  _/    _/  _/           ");			sLog->outString(" _/    _/  _/        _/    _/    _/_/_/    _/_/    _/    _/  _/_/_/_/  	");			sLog->outString(" Arkania Community (c) 2011");			sLog->outString("      <http://arkania.net/>");			sLog->outString(" ");			sLog->outString("<Ctrl-C> to stop./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");#endif //USE_SFMT_FOR_RNG			/// worldserver 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();			///- Initialize the signal handlers			WorldServerSignalHandler SignalINT, SignalTERM;#ifdef _WIN32			WorldServerSignalHandler SignalBREAK;#endif /* _WIN32 */			///- Register worldserver's signal handlersACE_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);	///- 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 are not accessible for the worldserver. Accessible processors bitmask (hex): %x", Aff, appAff);				}				else//.........这里部分代码省略.........
开发者ID:dsstest,项目名称:ArkCORE,代码行数:101,


示例18: main

// Launch the auth serverextern int main(int argc, char **argv){    sLog->SetLogDB(false);    // Command line parsing to get the configuration file name    char const* cfg_file = _AUTHSERVER_CONFIG;    int c = 1;    while(c < argc)    {        if (strcmp(argv[c], "-c") == 0)        {            if (++c >= argc)            {                sLog->outError("Runtime-Error: -c option requires an input argument");                usage(argv[0]);                return 1;            }            else                cfg_file = argv[c];        }        ++c;    }    if (!ConfigMgr::Load(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!");        return 1;    }    sLog->Initialize();    sLog->outString( "%s (authserver)", _FULLVERSION);    sLog->outString( "<Ctrl-C> to stop./n");    sLog->outString( "Using configuration file %s.", cfg_file);    sLog->outString(" ");    sLog->outString("   ______  __  __  __  __  ______ __  ______  ______ ");    sLog->outString("  ///  ___///// /// / /// //_// /////  ___/// /////  == /////  ___// ");    sLog->outString("  // //___  // //  _'-// //____ // //  __// // // //  __<// //  __// ");    sLog->outString("   /////_____// //_// //_/////_____// //_//  // //_// //_// //_// //_____// ");    sLog->outString("    ///_____////_////_////_____////_/   ///_////_/ /_////_____/ ");    sLog->outString("  Project SkyFireEmu 2012(c) Open-sourced Game Emulation ");    sLog->outString("           <http://www.projectskyfire.org/> ");    sLog->outString("<Ctrl-C> to stop./n");    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);#else    ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);#endif    sLog->outBasic("Max allowed open files is %d", ACE::max_handles());    // authserver 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);    }    // Initialize the database connection    if (!StartDB())        return 1;    // Initialize the log database    sLog->SetLogDBLater(ConfigMgr::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(ConfigMgr::GetIntDefault("RealmsStateUpdateDelay", 20));    if (sRealmList->size() == 0)    {        sLog->outError("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)    {        sLog->outError("Auth server can not bind to %s:%d", bind_ip.c_str(), rmport);        return 1;    }//.........这里部分代码省略.........
开发者ID:AwkwardDev,项目名称:Project-WoW,代码行数:101,


示例19: main

//.........这里部分代码省略.........    ///- Check the version of the configuration file    uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);    if (confVersion < _REALMDCONFVERSION)    {        sLog.outError("*****************************************************************************");        sLog.outError(" WARNING: Your realmd.conf version indicates your conf file is out of date!");        sLog.outError("          Please check for updates, as your current default values may cause");        sLog.outError("          strange behavior.");        sLog.outError("*****************************************************************************");        Log::WaitBeforeContinueIfNeed();    }    DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));    if (SSLeay() < 0x009080bfL )    {        DETAIL_LOG("WARNING: Outdated version of OpenSSL lib. Logins to server may not work!");        DETAIL_LOG("WARNING: Minimal required version [OpenSSL 0.9.8k]");    }    DETAIL_LOG("Using ACE: %s", ACE_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);#else    ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);#endif    sLog.outBasic("Max allowed open files is %d", ACE::max_handles());    /// realmd 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() );            Log::WaitBeforeContinueIfNeed();            return 1;        }        sLog.outString( "Daemon PID: %u/n", pid );    }    ///- Initialize the database connection    if(!StartDB())    {        Log::WaitBeforeContinueIfNeed();        return 1;    }    ///- Get the list of realms for the server    sRealmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));    if (sRealmList.size() == 0)    {        sLog.outError("No valid realms specified.");        Log::WaitBeforeContinueIfNeed();        return 1;    }    // cleanup query    // set expired bans to inactive    LoginDatabase.BeginTransaction();    LoginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");    LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate");    LoginDatabase.CommitTransaction();
开发者ID:Wisznu,项目名称:mangos,代码行数:67,


示例20: dup

// Main functionint Master::Run(){    int defaultStderr = dup(2);    if (sConfig.GetBoolDefault("Console.Enable", true))        sConsole.Initialize();    sConsole.SetLoading(true);    sConsole.DrawLogo();    // 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    _StartDB();    // Initialize the World    sWorld.SetInitialWorldSettings();    // set realmbuilds depend on OregonCore expected builds, and set server online    std::string builds = AcceptableClientBuildsListStr();    LoginDatabase.escape_string(builds);    LoginDatabase.PExecute("UPDATE realmlist SET realmflags = realmflags & ~(%u), population = 0, realmbuilds = '%s'  WHERE id = '%d'", REALM_FLAG_OFFLINE, builds.c_str(), realmID);    sConsole.SetLoading(false);    // Catch termination signals    _HookSignals();    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 Console::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 = 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 OregonCore. 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)        {            if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))                sLog.outString("OregonCore process priority class set to HIGH");            else                sLog.outError("ERROR: Can't set OregonCore process priority class.");            sLog.outString();        }    }    #endif    // Start soap serving thread    ACE_Based::Thread* soap_thread = NULL;    if (sConfig.GetBoolDefault("SOAP.Enabled", false))    {//.........这里部分代码省略.........
开发者ID:Adeer,项目名称:OregonCore,代码行数:101,



注:本文中的CreatePIDFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CreatePalette函数代码示例
C++ CreateNode函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。