From be1a48e8561125519dd956ecbdf491807e33b6cc Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 13 Feb 2023 20:20:44 -0600 Subject: [PATCH] Treat WSA_IO_PENDING as a receive timeout --- src/PlatformSockets.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/PlatformSockets.c b/src/PlatformSockets.c index 1dc98a3..268b36d 100644 --- a/src/PlatformSockets.c +++ b/src/PlatformSockets.c @@ -188,6 +188,12 @@ int recvUdpSocket(SOCKET s, char* buffer, int size, bool useSelect) { (LastSocketError() == EWOULDBLOCK || LastSocketError() == EINTR || LastSocketError() == EAGAIN || + #if defined(LC_WINDOWS) + // This error is specific to overlapped I/O which isn't even + // possible to perform with recvfrom(). It seems to randomly + // be returned instead of WSAETIMEDOUT on certain systems. + LastSocketError() == WSA_IO_PENDING || + #endif LastSocketError() == ETIMEDOUT)) { // Return 0 for timeout return 0;