⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 agentserversession.cpp

📁 奇迹世界 部分源代码奇迹世界 部分源代码奇迹世界 部分源代码
💻 CPP
字号:
#include "stdafx.h"
#include <PacketStruct.h>
#include <PacketStruct_AM.h>
#include <Protocol_AM.h>
#include <const.h>
#include "AgentServerSession.h"
#include "MasterServer.h"
#include "PacketHandler.h"
#include "ServerInfoManager.h"

AgentServerSession::AgentServerSession()
{
}

AgentServerSession::~AgentServerSession()
{
}

VOID AgentServerSession::Init()
{
	ServerSession::Init();
}

VOID AgentServerSession::Release()
{
	ServerSession::Release();
}

VOID AgentServerSession::Update()
{
	ServerSession::Update();
}

VOID AgentServerSession::OnRedirect()
{
	// 立加茄 俊捞傈飘 辑滚俊 鞘夸茄 立加 棺 府郊 沥焊甫 郴妨霖促.
	SERVER_KEY key		= GetServerKey();
	BYTE byWorldID		= key.GetWorldID();
	BYTE byChannelID	= key.GetChannelID();

	MessageOut( eCRITICAL_LOG, "Agent server connected.(%s)", GetIP() );

	SERVER_INFO gameDBProxyInfo;
	ServerInfoManager::Instance()->GetGameDBProxyInfo( byWorldID, &gameDBProxyInfo );
	SERVER_INFO agentServerInfo;
	ServerInfoManager::Instance()->GetAgentServerInfo( byWorldID, byChannelID, &agentServerInfo );
	SERVER_INFO worldServerInfo;
	ServerInfoManager::Instance()->GetWorldServerInfo( byWorldID, &worldServerInfo );
	SERVER_INFO authAgentServerInfo;
	ServerInfoManager::Instance()->GetAuthAgentServerInfo( byWorldID, &authAgentServerInfo );
	SERVER_INFO GuildServerInfo;
	ServerInfoManager::Instance()->GetGuildServerInfo( byWorldID, &GuildServerInfo );


	MSG_AM_CONNECTION_SERVER_INFO_CMD sendMsg;

	sendMsg.m_byCategory			= AM_CONNECTION;
	sendMsg.m_byProtocol			= AM_CONNECTION_SERVER_INFO_CMD;
	sendMsg.m_ServerKey				= key;
	sendMsg.m_dwServerGUID			= agentServerInfo.dwServerGUID;
	strncpy( sendMsg.m_szDBProxyServerIP, gameDBProxyInfo.szInnerIP, MAX_IP_STRING_LEN );
	sendMsg.m_wDBProxyServerPort	= gameDBProxyInfo.wInnerPort;
	strncpy( sendMsg.m_szAgentServerIP, agentServerInfo.szIP, MAX_IP_STRING_LEN );
	sendMsg.m_wAgentServerPort		= agentServerInfo.wPort;
	strncpy( sendMsg.m_szAgentServerInnerIP, agentServerInfo.szInnerIP, MAX_IP_STRING_LEN );
	sendMsg.m_wAgentServerInnerPort	= agentServerInfo.wInnerPort;
	strncpy( sendMsg.m_szWorldServerIP, worldServerInfo.szInnerIP, MAX_IP_STRING_LEN );
	sendMsg.m_wWorldServerPort		= worldServerInfo.wInnerPort;
	strncpy( sendMsg.m_szWorldServerClientIP, worldServerInfo.szIP , MAX_IP_STRING_LEN );
	sendMsg.m_wWorldServerClientPort = worldServerInfo.wPort;
	strncpy( sendMsg.m_szAuthAgentServerIP, authAgentServerInfo.szInnerIP , MAX_IP_STRING_LEN );
	sendMsg.m_wAuthAgentServerPort = authAgentServerInfo.wInnerPort;
	strncpy( sendMsg.m_szGuildServerIP, GuildServerInfo.szInnerIP , MAX_IP_STRING_LEN );
	sendMsg.m_wGuildServerPort = GuildServerInfo.wInnerPort;

	Send( (BYTE*)&sendMsg, sizeof(sendMsg) );
}

VOID AgentServerSession::OnConnect( BOOL bSuccess, DWORD dwNetworkIndex )
{
	ServerSession::OnConnect( bSuccess, dwNetworkIndex );
}

VOID AgentServerSession::OnDisconnect()
{
	ServerSession::OnDisconnect();

	SERVER_KEY key		= GetServerKey();
	MessageOut( eCRITICAL_LOG, "Agent server disconnected.[%u/%u]", key.GetWorldID(), key.GetChannelID() );
}

VOID AgentServerSession::OnRecv( BYTE *pMsg, WORD wSize )
{
	MSG_BASE *pBaseMsg = (MSG_BASE*)pMsg;

	PacketHandler::Instance()->ParsePacket_AM( this, (MSG_BASE*)pMsg, wSize );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -