Browse Source

Merge commit 'a7cbbc9' into cg_merges_20130524b

Conflicts:
	util.c
Luke Dashjr 12 years ago
parent
commit
51adcd2874
1 changed files with 10 additions and 7 deletions
  1. 10 7
      util.c

+ 10 - 7
util.c

@@ -245,12 +245,14 @@ static int keep_sockalive(SOCKETTYPE fd)
 		ret = 1;
 
 	if (!opt_delaynet)
+#ifndef __linux
+		if (unlikely(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const void *)&tcp_one, sizeof(tcp_one))))
+#else /* __linux */
 		if (unlikely(setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&tcp_one, sizeof(tcp_one))))
+#endif /* __linux */
 			ret = 1;
 
-#ifndef WIN32
-
-# ifdef __linux
+#ifdef __linux
 
 	if (unlikely(setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &tcp_one, sizeof(tcp_one))))
 		ret = 1;
@@ -260,15 +262,16 @@ static int keep_sockalive(SOCKETTYPE fd)
 
 	if (unlikely(setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &tcp_keepintvl, sizeof(tcp_keepintvl))))
 		ret = 1;
-# endif /* __linux */
-# ifdef __APPLE_CC__
+#endif /* __linux */
+
+#ifdef __APPLE_CC__
 
 	if (unlikely(setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &tcp_keepintvl, sizeof(tcp_keepintvl))))
 		ret = 1;
 
-# endif /* __APPLE_CC__ */
+#endif /* __APPLE_CC__ */
 
-#else /* WIN32 */
+#ifdef WIN32
 
 	const int zero = 0;
 	struct tcp_keepalive vals;