Fix net_accept() for UDP sockets on Windows
On Windows, recvfrom() returns an error code if the destination buffer is too
small to hold the next datagram.
diff --git a/library/net.c b/library/net.c
index bfa7072..b392879 100644
--- a/library/net.c
+++ b/library/net.c
@@ -309,6 +309,15 @@
ret = recvfrom( bind_fd, buf, sizeof( buf ), MSG_PEEK,
(struct sockaddr *) &client_addr, &n );
+
+#if defined(_WIN32)
+ if( ret == SOCKET_ERROR &&
+ WSAGetLastError() == WSAEMSGSIZE )
+ {
+ /* We know buf is too small, thanks, just peeking here */
+ ret = 0;
+ }
+#endif
}
if( ret < 0 )