📄 gameserversession.cpp
字号:
#include "stdafx.h"
#include "GameServerSession.h"
#include "PacketHandler.h"
#include "ServerInfoManager.h"
#include <PacketStruct.h>
#include <PacketStruct_GM.h>
#include <Protocol_GM.h>
GameServerSession::GameServerSession()
{
}
GameServerSession::~GameServerSession()
{
}
VOID GameServerSession::Init()
{
ServerSession::Init();
}
VOID GameServerSession::Release()
{
ServerSession::Release();
}
VOID GameServerSession::Update()
{
ServerSession::Update();
}
VOID GameServerSession::OnRedirect()
{
// 立加茄 霸烙 辑滚俊 鞘夸茄 立加 棺 府郊 沥焊甫 郴妨霖促.
SERVER_KEY key = GetServerKey();
BYTE byWorldId = key.GetWorldID();
BYTE byChannelID = key.GetChannelID();
SERVER_INFO gameDBProxyInfo;
ServerInfoManager::Instance()->GetGameDBProxyInfo( byWorldId, &gameDBProxyInfo );
SERVER_INFO agentServerInfo;
ServerInfoManager::Instance()->GetAgentServerInfo( byWorldId, byChannelID, &agentServerInfo );
SERVER_INFO guildServerInfo;
ServerInfoManager::Instance()->GetGuildServerInfo( byWorldId, &guildServerInfo );
SERVER_INFO * pMyServerInfo = ServerInfoManager::Instance()->GetServerInfo(key);
ASSERT(pMyServerInfo);
MSG_GM_CONNECTION_SERVER_INFO_CMD sendMsg;
sendMsg.m_byCategory = GM_CONNECTION;
sendMsg.m_byProtocol = GM_CONNECTION_SERVER_INFO_CMD;
sendMsg.m_ServerKey = key;
sendMsg.m_dwServerGUID = pMyServerInfo->dwServerGUID;
strncpy( sendMsg.m_szDBProxyServerIP, gameDBProxyInfo.szInnerIP, MAX_IP_STRING_LEN );
sendMsg.m_wDBProxyServerPort = gameDBProxyInfo.wInnerPort;
strncpy( sendMsg.m_szAgentServerIP, agentServerInfo.szInnerIP, MAX_IP_STRING_LEN );
sendMsg.m_wAgentServerPort = agentServerInfo.wInnerPort;
strncpy( sendMsg.m_szGuildServerIP, guildServerInfo.szInnerIP, MAX_IP_STRING_LEN );
sendMsg.m_wGuildServerPort = guildServerInfo.wInnerPort;
Send( (BYTE*)&sendMsg, sizeof(sendMsg) );
}
VOID GameServerSession::OnConnect( BOOL bSuccess, DWORD dwNetworkIndex )
{
ServerSession::OnConnect( bSuccess, dwNetworkIndex );
}
VOID GameServerSession::OnDisconnect()
{
ServerSession::OnDisconnect();
}
VOID GameServerSession::OnRecv( BYTE *pMsg, WORD wSize )
{
if( !PacketHandler::Instance()->ParsePacket_GM( this, (MSG_BASE*)pMsg, wSize ) )
{
MessageOut( eCRITICAL_LOG, "Invalid packet from game server! ServerType(%d)", GetServerType() );
}
}
// 霸烙 辑滚啊 connect 秦具 且 DB 橇遏矫 辑滚狼 IP客 器飘甫 舅妨霖促.
VOID GameServerSession::SendDBProxyServerInfo()
{
/*
SERVER_INFO dbProxyServerInfo;
ServerInfoManager::Instance()->GetDBProxyServerInfo( &dbProxyServerInfo );
MSG_GM_CONNECTION_REQ_DBPROXY_SERVER_INFO_ACK sendMsg;
sendMsg.m_byCategory = GM_OTHER;
sendMsg.m_byProtocol = GM_CONNECTION_REQ_DBPROXY_SERVER_INFO_ACK;
sendMsg.m_wPort = dbProxyServerInfo.wInnerPort;
strncpy( sendMsg.m_szIP, dbProxyServerInfo.szInnerIP, MAX_IP_STRING_LEN );
Send( (BYTE*)&sendMsg, sizeof(sendMsg) );
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -