From 74361d859354e4416285cd803b1b0075be1fe514 Mon Sep 17 00:00:00 2001 From: B Stack Date: Mon, 5 Apr 2021 11:02:07 -0400 Subject: add upstream 11.9 --- zen/socket.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'zen/socket.h') diff --git a/zen/socket.h b/zen/socket.h index 2dd1ff4c..f9813852 100644 --- a/zen/socket.h +++ b/zen/socket.h @@ -14,6 +14,7 @@ #include //getaddrinfo + namespace zen { #define THROW_LAST_SYS_ERROR_WSA(functionName) \ @@ -48,11 +49,15 @@ public: const auto getConnectedSocket = [](const auto& /*::addrinfo*/ ai) { - SocketType testSocket = ::socket(ai.ai_family, ai.ai_socktype, ai.ai_protocol); + SocketType testSocket = ::socket(ai.ai_family, //int socket_family + SOCK_CLOEXEC | + ai.ai_socktype, //int socket_type + ai.ai_protocol); //int protocol if (testSocket == invalidSocket) THROW_LAST_SYS_ERROR_WSA("socket"); ZEN_ON_SCOPE_FAIL(closeSocket(testSocket)); + if (::connect(testSocket, ai.ai_addr, static_cast(ai.ai_addrlen)) != 0) THROW_LAST_SYS_ERROR_WSA("connect"); -- cgit