Commit a7cbbc9fc3cf529025bbd64570d75783cdfd7a54

ckolivas 2013-05-09T12:08:42

Set TCP_NODELAY for !linux for raw sockets.

diff --git a/util.c b/util.c
index 330b49e..f599ac8 100644
--- a/util.c
+++ b/util.c
@@ -207,15 +207,21 @@ static void keep_sockalive(SOCKETTYPE fd)
 
 	setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (const void *)&tcp_one, sizeof(tcp_one));
 	if (!opt_delaynet)
+#ifndef __linux
+		setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const void *)&tcp_one, sizeof(tcp_one));
+#else /* __linux */
 		setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&tcp_one, sizeof(tcp_one));
-# ifdef __linux
+#endif /* __linux */
+
+#ifdef __linux
 	setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &tcp_one, sizeof(tcp_one));
 	setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &tcp_keepidle, sizeof(tcp_keepidle));
 	setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &tcp_keepintvl, sizeof(tcp_keepintvl));
-# endif /* __linux */
-# ifdef __APPLE_CC__
+#endif /* __linux */
+
+#ifdef __APPLE_CC__
 	setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &tcp_keepintvl, sizeof(tcp_keepintvl));
-# endif /* __APPLE_CC__ */
+#endif /* __APPLE_CC__ */
 }
 
 #if CURL_HAS_KEEPALIVE