Charles Davis : ws2_32: Implement setting the keep-alive idle timeout and interval on Mac OS.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 6 10:15:44 CDT 2015


Module: wine
Branch: master
Commit: 4829989c19de47b7c64fb8f5deb9877d96602442
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4829989c19de47b7c64fb8f5deb9877d96602442

Author: Charles Davis <cdavis5x at gmail.com>
Date:   Sun Aug  2 17:54:42 2015 -0600

ws2_32: Implement setting the keep-alive idle timeout and interval on Mac OS.

---

 dlls/ws2_32/socket.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index b06d7e7..79aaaf9 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -172,6 +172,11 @@
 #define INADDR_NONE ~0UL
 #endif
 
+#if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE)
+/* TCP_KEEPALIVE is the Mac OS name for TCP_KEEPIDLE */
+#define TCP_KEEPIDLE TCP_KEEPALIVE
+#endif
+
 WINE_DEFAULT_DEBUG_CHANNEL(winsock);
 WINE_DECLARE_DEBUG_CHANNEL(winediag);
 
@@ -4459,14 +4464,23 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
         fd = get_sock_fd(s, 0, NULL);
         if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&keepalive, sizeof(int)) == -1)
             status = WSAEINVAL;
-#if defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTVL)
+#if defined(TCP_KEEPIDLE) || defined(TCP_KEEPINTVL)
         /* these values need to be set only if SO_KEEPALIVE is enabled */
         else if(keepalive)
         {
+#ifndef TCP_KEEPIDLE
+            FIXME("ignoring keepalive timeout\n");
+#else
             if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, (void *)&keepidle, sizeof(int)) == -1)
                 status = WSAEINVAL;
-            else if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&keepintvl, sizeof(int)) == -1)
+            else
+#endif
+#ifdef TCP_KEEPINTVL
+            if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&keepintvl, sizeof(int)) == -1)
                 status = WSAEINVAL;
+#else
+                FIXME("ignoring keepalive interval\n");
+#endif
         }
 #else
         else




More information about the wine-cvs mailing list