ws2_32: socket keepalive for OSX

Matt Durgavich mattdurgavich at gmail.com
Wed Jul 29 20:30:11 CDT 2015


Set socket options for keepalive on OSX tcp connections.
No tests at this time.

dlls/ws2_32/socket.c | 9 +++++++++
 1 file changed, 9 insertions(+)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20150729/0751f3f5/attachment.html>
-------------- next part --------------
From e96c028c3c8f11697c3c8a46f6840be5b7a69530 Mon Sep 17 00:00:00 2001
From: Matt Durgavich <mdurgavich at kayak.com>
Date: Tue, 21 Jul 2015 18:28:49 -0400
Subject: Socket keepalive for OSX

---
 dlls/ws2_32/socket.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index b06d7e7..220bdf1 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -4468,6 +4468,15 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
             else if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&keepintvl, sizeof(int)) == -1)
                 status = WSAEINVAL;
         }
+#elif defined(SO_KEEPALIVE) && defined(TCP_KEEPALIVE)
+	/* BSDish platforms like Darwin */
+	else if (keepalive)
+	{
+	    if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void*)&keepalive, sizeof(int)) == 1)
+		status = WSAEINVAL;
+	    else if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, (void*)&keepintvl, sizeof(int)) == -1)
+		status = WSAEINVAL;
+	}
 #else
         else
             FIXME("ignoring keepalive interval and timeout\n");
-- 
2.3.2 (Apple Git-55)



More information about the wine-patches mailing list