예제 #1
0
int ENET_CALLBACK TraversalClient::InterceptCallback(ENetHost* host, ENetEvent* event)
{
	auto traversalClient = g_TraversalClient.get();
	if (traversalClient->TestPacket(host->receivedData, host->receivedDataLength, &host->receivedAddress))
	{
		event->type = (ENetEventType)42;
		return 1;
	}
	return 0;
}
예제 #2
0
//--Temporary until more of the old netplay branch is moved over
void TraversalClient::Update()
{
  ENetEvent netEvent;
  if (enet_host_service(m_NetHost, &netEvent, 4) > 0)
  {
    switch (netEvent.type)
    {
    case ENET_EVENT_TYPE_RECEIVE:
      TestPacket(netEvent.packet->data, netEvent.packet->dataLength, &netEvent.peer->address);

      enet_packet_destroy(netEvent.packet);
      break;
    default:
      break;
    }
  }
  HandleResends();
}