From 4171390f421c9c2e52dbeb0d0824edbd14ae5676 Mon Sep 17 00:00:00 2001 From: Jack Garrard Date: Thu, 27 Oct 2022 04:51:36 -0700 Subject: [PATCH] Allow hole punch packets to get through before udp fully recved --- source/server/SocketClient.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/server/SocketClient.cpp b/source/server/SocketClient.cpp index 7a724fa..c3ff1b9 100644 --- a/source/server/SocketClient.cpp +++ b/source/server/SocketClient.cpp @@ -170,8 +170,14 @@ bool SocketClient::send(Packet *packet) { int valread = 0; int fd = -1; - if ((packet->mType != PLAYERINF && packet->mType != HACKCAPINF && packet->mType != HOLEPUNCH) || !this->mHasRecvUdp) { - Logger::log("Sending packet: %s\n", packetNames[packet->mType]); + if ((packet->mType != PLAYERINF && packet->mType != HACKCAPINF && packet->mType != HOLEPUNCH) + || (!this->mHasRecvUdp && packet->mType != HOLEPUNCH) + || this->mUdpAddress.port == 0) { + + if (packet->mType != PLAYERINF && packet->mType != HACKCAPINF) { + Logger::log("Sending packet: %s\n", packetNames[packet->mType]); + } + fd = this->socket_log_socket; } else {