lgincomingconnectionhandler.cpp
来自「天之炼狱1服务器端源文件游戏服务端不完整」· C++ 代码 · 共 141 行
CPP
141 行
//----------------------------------------------------------------------//// Filename : LGIncomingConnectionHandler.cpp// Written By : Reiot// Description :////----------------------------------------------------------------------// include files#include "LGIncomingConnection.h"#include "Properties.h"#ifdef __GAME_SERVER__ #include "ConnectionInfo.h" #include "ConnectionInfoManager.h" #include "LoginServerManager.h" #include "LogDef.h" #include "Gpackets/GLIncomingConnectionError.h" #include "Gpackets/GLIncomingConnectionOK.h"#endif//----------------------------------------------------------------------// // LGIncomingConnectionHander::execute()// // 霸烙 辑滚啊 肺弊牢 辑滚肺何磐 LGIncomingConnection 菩哦阑 罐霸 登搁,// ConnectionInfo甫 货肺 眠啊窍霸 等促.// //----------------------------------------------------------------------void LGIncomingConnectionHandler::execute ( LGIncomingConnection * pPacket ) throw ( ProtocolException , Error ){ __BEGIN_TRY __BEGIN_DEBUG_EX#ifdef __GAME_SERVER__ //-------------------------------------------------------------------------------- // // 牢刘虐甫 积己茄促. // // *NOTE* // // 扁粮狼 规侥篮 肺弊牢 辑滚俊辑 牢刘虐甫 积己秦辑 霸烙辑滚俊 焊辰 饶, 努扼捞攫飘肺 // 傈价沁促. 捞犯霸 且 版快 CLSelectPCHandler::execute()俊辑 牢刘虐甫 积己窍绊 // GLIncomingConnectionOKHandler::execute()俊辑 牢刘虐甫 努扼捞攫飘肺 焊郴霸 登绰单, // 贸府 皋筋靛啊 促福骨肺 虐蔼捞 绢叼俊急啊 蜡瘤登绢具 茄促. 啊厘 窜鉴茄 规过篮 肺弊牢 // 敲饭捞绢 按眉俊 历厘窍搁 登绰单.. 购啊 操瘤窍促. 肚促弗 规过篮 霸烙 辑滚俊辑 促矫 // 肺弊牢 辑滚肺 虐蔼阑 登倒妨林绰 巴牢单, 捞绰 匙飘况农惑俊 虐蔼捞 2雀 空汗茄促绰 // 痢俊辑 阂鞘夸窍促. // // 蝶扼辑, 霸烙 辑滚俊辑 积己秦辑 肺弊牢辑滚俊 焊郴林绰 祈捞 任纠 彬阐秦瘤霸 等促. // // *TODO* // // 弥厩狼 版快, 肺拿匙飘况农啊 胶聪欺傅寸秦辑 虐蔼捞 蜡免瞪 荐 乐促. (窍变 构 风飘 // 菩胶况靛啊 蜡免瞪 啊瓷己档 乐绰单.. - -; 捞繁 芭具 SSL阑 结具 窍绰芭绊..) // 捞甫 措厚秦辑 GLIncomingConnectionOK 菩哦篮 鞠龋拳登绢具 茄促. // // 肚茄 虐蔼篮 抗螟阂啊瓷秦具 茄促. (绢瞒乔 内靛甫 焊搁 抗螟啊瓷秦柳促.) // //-------------------------------------------------------------------------------- DWORD authKey = rand() << ( time(0) % 10 ) + rand() >> ( time(0)% 10 ); // CI 按眉甫 积己茄促. ConnectionInfo * pConnectionInfo = new ConnectionInfo(); pConnectionInfo->setClientIP( pPacket->getClientIP() ); pConnectionInfo->setKey( authKey ); pConnectionInfo->setPlayerID( pPacket->getPlayerID() ); pConnectionInfo->setPCName( pPacket->getPCName() ); //-------------------------------------------------------------------------------- // // 泅犁 矫埃 + 20 檬 饶甫 expire time 栏肺 汲沥茄促. // // *TODO* // // expire period 开矫 Config 颇老俊辑 瘤沥秦林搁 亮摆促. // //-------------------------------------------------------------------------------- Timeval currentTime; getCurrentTime(currentTime); currentTime.tv_sec += 30; pConnectionInfo->setExpireTime( currentTime ); // debug message /* cout << "+--------------------------------+" << endl << "| Incoming Connection Infomation |" << endl << "+--------------------------------+" << endl << "ClientIP : " << pPacket->getClientIP() << endl << "Auth Key : " << authKey << endl << "P C Name : " << pPacket->getPCName() << endl; */ try { // CIM 俊 眠啊茄促. g_pConnectionInfoManager->addConnectionInfo( pConnectionInfo ); // by sigi. 2002.12.7 FILELOG_INCOMING_CONNECTION("connectionInfo.log", "Add [%s:%s] %s (%u)", pPacket->getPlayerID().c_str(), pPacket->getPCName().c_str(), pPacket->getClientIP().c_str(), authKey); // 肺弊牢 辑滚俊霸 促矫 舅妨霖促. GLIncomingConnectionOK glIncomingConnectionOK; glIncomingConnectionOK.setPlayerID( pPacket->getPlayerID() ); glIncomingConnectionOK.setTCPPort( g_pConfig->getPropertyInt("TCPPort") ); glIncomingConnectionOK.setKey( authKey ); g_pLoginServerManager->sendPacket( pPacket->getHost() , pPacket->getPort() , &glIncomingConnectionOK ); //cout << "LGIncomingConnectionHandler Send Packet to ServerIP : " << pPacket->getHost() << endl; //cout << "LGIncomingConnectionHandler Send Packet to ServerPort : " << pPacket->getPort() << endl; } catch ( DuplicatedException & de ) { // 角菩沁阑 版快 CI 甫 昏力窍绊, 肺弊牢 辑滚俊霸 GLIncomingConnectionError 菩哦阑 傈价茄促. SAFE_DELETE(pConnectionInfo);// GLIncomingConnectionError glIncomingConnectionError;// glIncomingConnectionError.setMessage( de.toString() );// glIncomingConnectionError.setPlayerID( pPacket->getPlayerID() );// cout << "Step 5" << endl;// g_pLoginServerManager->sendPacket( pPacket->getHost() , pPacket->getPort() , &glIncomingConnectionError );// cout << "LGIncomingConnectionHandler Send Packet to ServerIP : " << pPacket->getHost() << endl; } #endif __END_DEBUG_EX __END_CATCH}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?