示例#1
0
//--------------------------------------------------------------------------
void Connection::UpdateForeground()
{
	for(VeUInt32 i(0); i < m_kPacketCache.Size(); ++i)
	{
		Packet* pkPacket = m_kPacketCache[i];
		BitStream kStream((unsigned char*)pkPacket->data, pkPacket->length, false);
		VeUInt8 u8Event;
		kStream >> u8Event;
		switch(u8Event)
		{
		case ID_DISCONNECTION_NOTIFICATION:
			ConnectFailed(CONNECT_FAIL_NORMAL);
			break;
		case ID_REMOTE_CONNECTION_LOST:
			ConnectFailed(CONNECT_FAIL_NORMAL);
			break;
		case ID_CONNECTION_BANNED:
			ConnectFailed(CONNECT_FAIL_SERVER_FULL);
			break;			
		case ID_NO_FREE_INCOMING_CONNECTIONS:
			ConnectFailed(CONNECT_FAIL_SERVER_FULL);
			break;
		case ID_CONNECTION_LOST:
			ConnectFailed(CONNECT_FAIL_NORMAL);
			break;
		case ID_CONNECTION_REQUEST_ACCEPTED:
			VE_ASSERT(!(m_pkServer->IsServerConnected()));
			m_pkServer->SetServerID(pkPacket->systemAddress);
			m_pkServer->OnConnect();
			break;
		case ID_CONNECTION_ATTEMPT_FAILED:
			ConnectFailed(CONNECT_FAIL_NORMAL);
			break;
		case ID_CLIENT_GLOBAL_RPC:
			m_pkServer->OnGlobalRPCCallback(kStream);
			break;
		case ID_CLIENT_ENTITY_RPC:
			m_pkServer->OnEntityRPCCallback(kStream);
			break;
		case ID_CLIENT_ENTITY_UPDATE:
			m_pkServer->EntityUpdate(kStream);
			break;
		case ID_CLIENT_ENTITY_DESTORY:
			m_pkServer->EntityDestory(kStream);
			break;
		case ID_CLIENT_FORCE_DISCONNECT:
			ForceDisconnect(CONNECT_FORCE_OFF);
			break;
		default:
			break;
		}
		m_pkPeer->DeallocatePacket(pkPacket);
	}
	m_kPacketCache.Clear();
}
void connect_test::ConnectCancelled()
{
    ConnectFailed();
}
void test_base::ConnectCancelled()
{
    ConnectFailed();
}
示例#4
0
//--------------------------------------------------------------------------
void Connection::ForceDisconnect(ConnectFail eFail)
{
	ConnectFailed(eFail);
}