From 6414b838c0b48e85bf3d8f05bbce5a0c5dec112f Mon Sep 17 00:00:00 2001 From: Tomasz Konojacki Date: Fri, 16 Jul 2021 04:12:17 +0200 Subject: [PATCH] win32sck.c: set WSA_FLAG_OVERLAPPED on new sockets This makes it possible to perform overlapped operations on sockets created by Perl. I'm not aware of any downsides to enabling that flag, winsock documentation says that "most sockets should be created with this flag set". Perl libuv bindings require this change to work on Windows: https://github.com/p5-UV/p5-UV/issues/38 https://github.com/p5-UV/p5-UV/issues/35 --- win32/win32sck.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win32/win32sck.c b/win32/win32sck.c index ef5c682101c8..afca01d8e0f6 100644 --- a/win32/win32sck.c +++ b/win32/win32sck.c @@ -618,7 +618,7 @@ open_ifs_socket(int af, int type, int protocol) SOCKET out = INVALID_SOCKET; if ((s = PerlEnv_getenv("PERL_ALLOW_NON_IFS_LSP")) && atoi(s)) - return WSASocket(af, type, protocol, NULL, 0, 0); + return WSASocket(af, type, protocol, NULL, 0, WSA_FLAG_OVERLAPPED); if (WSCEnumProtocols(NULL, NULL, &proto_buffers_len, &error_code) == SOCKET_ERROR && error_code == WSAENOBUFS) @@ -649,7 +649,7 @@ open_ifs_socket(int af, int type, int protocol) found = 1; convert_proto_info_w2a(&(proto_buffers[i]), &proto_info); - out = WSASocket(af, type, protocol, &proto_info, 0, 0); + out = WSASocket(af, type, protocol, &proto_info, 0, WSA_FLAG_OVERLAPPED); break; }