📄 clientmanager.cpp
字号:
////////////////////////////////////////////////////////////////////////// Filename : ClientManager.cpp// Written by : reiot@ewestsoft.com// Description : 肺弊牢 辑滚侩 努扼捞攫飘 概聪历////////////////////////////////////////////////////////////////////////#include "DatabaseManager.h"#include "ClientManager.h"#include "Assert.h"#include "LoginPlayerManager.h"#include "ReconnectLoginInfoManager.h"#include "Profile.h"#include "PacketProfile.h"#include "Timeval.h"#include "Properties.h"#include "GameWorldInfoManager.h"#include "GameServerGroupInfoManager.h"////////////////////////////////////////////////////////////////////////// constructor//// 窍困 概聪历 按眉甫 积己窍绰 镑捞促.////////////////////////////////////////////////////////////////////////ClientManager::ClientManager () throw ( Error ){ __BEGIN_TRY // 肺弊牢 敲饭捞绢 概聪历甫 积己茄促. g_pLoginPlayerManager = new LoginPlayerManager(); __END_CATCH}////////////////////////////////////////////////////////////////////////// destructor//// 窍困 概聪历 按眉甫 昏力窍绰 镑捞促.////////////////////////////////////////////////////////////////////////ClientManager::~ClientManager () throw ( Error ){ __BEGIN_TRY // 肺弊牢 敲饭捞绢 概聪历甫 昏力茄促. if ( g_pLoginPlayerManager != NULL ) { delete g_pLoginPlayerManager; g_pLoginPlayerManager = NULL; } __END_CATCH}////////////////////////////////////////////////////////////////////////// 窍困 概聪历 按眉甫 檬扁拳窍绊, 磊脚阑 檬扁拳茄促.////////////////////////////////////////////////////////////////////////void ClientManager::init () throw ( Error ){ __BEGIN_TRY g_pLoginPlayerManager->init(); __END_CATCH}////////////////////////////////////////////////////////////////////////// 辑厚胶甫 矫累茄促.////////////////////////////////////////////////////////////////////////void ClientManager::start () throw ( Error ){ __BEGIN_TRY run(); // 官肺 run() 皋筋靛甫 龋免茄促. ^^; __END_CATCH}////////////////////////////////////////////////////////////////////////// 磊脚狼 辑厚胶甫 吝窜茄 饶, 窍困 概聪历 按眉甸狼 辑厚胶甫 吝窜矫挪促.////////////////////////////////////////////////////////////////////////void ClientManager::stop () throw ( Error ){ __BEGIN_TRY throw UnsupportedError("stopping manager not supported."); __END_CATCH}//////////////////////////////////////////////////////////////////////// 努扼捞攫飘 概聪历狼 皋牢 风橇捞促.//////////////////////////////////////////////////////////////////////void ClientManager::run () throw ( Error ){ __BEGIN_TRY Assert( g_pLoginPlayerManager != NULL ); Timeval NextTime; getCurrentTime(NextTime); // GameWorldInfo, GameServerInfo 货肺 肺靛窍绰 矫埃 Timeval ReloadNextTime = NextTime; // GameWorldInfo, GameServerInfo 货肺 肺靛窍绰 矫埃 埃拜, 盒 窜困 int ReloadGap = g_pConfig->getPropertyInt("ServerInfoReloadTime") * 60; ReloadNextTime.tv_sec += ReloadGap; NextTime.tv_sec += 10; Timeval dummyQueryTime; getCurrentTime(dummyQueryTime); while ( true ) { usleep(100); beginProfileEx("LS_MAIN"); beginProfileEx("LPM_SELECT"); g_pLoginPlayerManager->select(); endProfileEx("LPM_SELECT"); beginProfileEx("LPM_EXCEPTION"); g_pLoginPlayerManager->processExceptions(); endProfileEx("LPM_EXCEPTION"); beginProfileEx("LPM_INPUT"); g_pLoginPlayerManager->processInputs(); endProfileEx("LPM_INPUT"); beginProfileEx("LPM_COMMAND"); g_pLoginPlayerManager->processCommands(); endProfileEx("LPM_COMMAND"); beginProfileEx("LPM_OUTPUT"); g_pLoginPlayerManager->processOutputs(); endProfileEx("LPM_OUTPUT"); beginProfileEx("LPM_HEARTBEAT"); g_pReconnectLoginInfoManager->heartbeat(); endProfileEx("LPM_HEARTBEAT"); endProfileEx("LS_MAIN"); Timeval currentTime; getCurrentTime(currentTime); if (NextTime < currentTime) { //outputProfileEx(false, false); (g_ProfileSampleManager.getProfileSampleSet())->outputProfileToFile("Profile", false, false); NextTime.tv_sec = currentTime.tv_sec + 10; NextTime.tv_usec = currentTime.tv_usec; // 概畔付促 橇肺颇老 单捞磐甫 檬扁拳秦霖促. // 穿利 单捞磐焊促绰 矫埃措俊 蝶弗 矫埃阑 螟沥窍扁 困秦辑... initProfileEx(); //g_PacketProfileManager.outputResultToFile("PacketProfile.txt"); g_PacketProfileManager.init(); } if ( ReloadNextTime < currentTime ) { if ( g_pGameWorldInfoManager != NULL ) { g_pGameWorldInfoManager->load(); } if ( g_pGameServerGroupInfoManager != NULL ) { g_pGameServerGroupInfoManager->load(); } ReloadNextTime.tv_sec += ReloadGap; } // DB connection 捞 timeout 栏肺 谗绢瘤瘤 臼霸 啊阐究 狼固绝绰 孽府窃秦霖促. // by bezz. 2003.04.21 if ( dummyQueryTime < currentTime ) { g_pDatabaseManager->executeDummyQuery( g_pDatabaseManager->getConnection("DARKEDEN") ); dummyQueryTime.tv_sec += (60+rand()%30) * 60; } } __END_CATCH} // global variable definitionClientManager * g_pClientManager = NULL;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -