From c689e9cde0364a524e5e73fa1f966e6d0ff11cb8 Mon Sep 17 00:00:00 2001 From: Floogle <18466542+skyfloogle@users.noreply.github.com> Date: Mon, 26 Dec 2022 23:35:42 +0100 Subject: [PATCH] Netplay: When connecting, ignore packets from traversal server --- Source/Core/Core/NetPlayClient.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 3208caee36..265dcd2402 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -248,7 +248,12 @@ bool NetPlayClient::Connect() sf::Packet rpac; // TODO: make this not hang ENetEvent netEvent; - if (enet_host_service(m_client, &netEvent, 5000) > 0 && netEvent.type == ENET_EVENT_TYPE_RECEIVE) + int net; + while ((net = enet_host_service(m_client, &netEvent, 5000)) > 0 && netEvent.type == 42) + { + // ignore packets from traversal server + } + if (net > 0 && netEvent.type == ENET_EVENT_TYPE_RECEIVE) { rpac.append(netEvent.packet->data, netEvent.packet->dataLength); enet_packet_destroy(netEvent.packet);