Exemple #1
0
bool ILogicEntry::ProcessConnectorPacket(BasePacket* pPacket)
{
    SFServerConnectionManager* pManager = SFEngine::GetInstance()->GetServerConnectionManager();
    auto connector = pManager->GetConnectedServer().find(pPacket->GetSerial());

    if (connector != pManager->GetConnectedServer().end())
    {
        auto& callback = m_mapConnectorCallback.find(connector->second->GetServerInfo().identifer);

        if (callback != m_mapConnectorCallback.end())
        {
            INetworkCallback* pCallback = callback->second;
            switch (pPacket->GetPacketType())
            {

            case SFPACKET_DATA:
                pCallback->HandleNetworkMessage(pPacket);
                break;

            case SFPACKET_CONNECT:
                pCallback->HandleConnect(pPacket->GetSerial());
                break;

            case  SFPACKET_DISCONNECT:
                pCallback->HandleDisconnect(pPacket->GetSerial());
                break;

            default:
                return false;
            }
        }
    }
    return true;
}
Exemple #2
0
bool ILogicEntry::ProcessConnectorPacket(BasePacket* pPacket)
{
	_SessionDesc& desc = pPacket->GetSessionDesc();

	const auto& callback = m_mapConnectorCallback.find(desc.identifier);

	if (callback != m_mapConnectorCallback.end())
	{
		INetworkCallback* pCallback = callback->second;
		switch (pPacket->GetPacketType())
		{

		case SFPACKET_DATA:
			pCallback->HandleNetworkMessage(pPacket);
			break;

		case SFPACKET_CONNECT:
			pCallback->HandleConnect(pPacket->GetSerial(), pPacket->GetSessionDesc());
			break;

		case  SFPACKET_DISCONNECT:
		{
			pCallback->HandleDisconnect(pPacket->GetSerial(), pPacket->GetSessionDesc());
			SFServerConnectionManager* pManager = SFEngine::GetInstance()->GetServerConnectionManager();
			pManager->SetConnectorState(desc.identifier, false);
		}
			break;

		default:
			return false;
		}
	}

	return true;
}