From 2a3221ce8652e701eefcc729fb6cf2f1dba8d87a Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 17 Apr 2021 05:28:24 +0300
Subject: [PATCH] do not call WSACancelBlockingCall() in winsock2 builds.
See https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsacancelblockingcall
---
SDLnet.c | 2 +-
SDLnetsys.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/SDLnet.c b/SDLnet.c
index 3461b70..1ace0de 100644
--- a/SDLnet.c
+++ b/SDLnet.c
@@ -105,7 +105,7 @@ void SDLNet_Quit(void)
/* Clean up windows networking */
if ( WSACleanup() == SOCKET_ERROR ) {
if ( WSAGetLastError() == WSAEINPROGRESS ) {
-#ifndef _WIN32_WCE
+#if !(defined(_WIN32_WCE)||defined(__USE_WINSOCK2))
WSACancelBlockingCall();
#endif
WSACleanup();
diff --git a/SDLnetsys.h b/SDLnetsys.h
index db92924..1035ba7 100644
--- a/SDLnetsys.h
+++ b/SDLnetsys.h
@@ -34,6 +34,7 @@
#if defined(__WIN32__) || defined(WIN32)
#define __USE_W32_SOCKETS
#if defined(_WIN64) || defined(__MINGW64_VERSION_MAJOR)
+#define __USE_WINSOCK2
#include <winsock2.h>
#include <ws2tcpip.h>
#else