From e9a7eeaf9ce56500d7680eb4026b31d654d4f044 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Fri, 5 May 2017 17:41:11 +0200 Subject: [PATCH] Fix UDP wait() not returning after first received packet (cherry picked from commit 5c6715a291e0e843b56f0a168191b3d89657d43f) --- drivers/unix/packet_peer_udp_posix.cpp | 2 ++ platform/windows/packet_peer_udp_winsock.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp index b900a72b11d..afabe9dea99 100644 --- a/drivers/unix/packet_peer_udp_posix.cpp +++ b/drivers/unix/packet_peer_udp_posix.cpp @@ -216,6 +216,8 @@ Error PacketPeerUDPPosix::_poll(bool p_wait) { len = sizeof(struct sockaddr_storage); ++queue_count; + if (p_wait) + break; }; // TODO: Should ECONNRESET be handled here? diff --git a/platform/windows/packet_peer_udp_winsock.cpp b/platform/windows/packet_peer_udp_winsock.cpp index eed61810bac..b59056a3d06 100644 --- a/platform/windows/packet_peer_udp_winsock.cpp +++ b/platform/windows/packet_peer_udp_winsock.cpp @@ -203,6 +203,8 @@ Error PacketPeerUDPWinsock::_poll(bool p_wait) { len = sizeof(struct sockaddr_storage); ++queue_count; + if (p_wait) + break; }; if (ret == SOCKET_ERROR) {