Lines 1-46
Link Here
|
1 |
--- src/util.c.orig 2011-12-07 15:04:13.000000000 +0400 |
|
|
2 |
+++ src/util.c 2011-12-07 15:04:07.000000000 +0400 |
3 |
@@ -126,7 +126,7 @@ |
4 |
res = setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &val, sizeof(val)); |
5 |
if (res < 0) |
6 |
goto fail; |
7 |
-#ifdef __linux__ |
8 |
+#ifdef TCP_KEEPCNT |
9 |
/* set count of keepalive packets */ |
10 |
if (cf_tcp_keepcnt > 0) { |
11 |
val = cf_tcp_keepcnt; |
12 |
@@ -134,6 +134,8 @@ |
13 |
if (res < 0) |
14 |
goto fail; |
15 |
} |
16 |
+#endif |
17 |
+#ifdef TCP_KEEPIDLE |
18 |
/* how long the connection can stay idle before sending keepalive pkts */ |
19 |
if (cf_tcp_keepidle) { |
20 |
val = cf_tcp_keepidle; |
21 |
@@ -141,6 +143,8 @@ |
22 |
if (res < 0) |
23 |
goto fail; |
24 |
} |
25 |
+#endif |
26 |
+#ifdef TCP_KEEPINTVL |
27 |
/* time between packets */ |
28 |
if (cf_tcp_keepintvl) { |
29 |
val = cf_tcp_keepintvl; |
30 |
@@ -148,7 +152,7 @@ |
31 |
if (res < 0) |
32 |
goto fail; |
33 |
} |
34 |
-#else |
35 |
+#endif |
36 |
#ifdef TCP_KEEPALIVE |
37 |
if (cf_tcp_keepidle) { |
38 |
val = cf_tcp_keepidle; |
39 |
@@ -157,7 +161,6 @@ |
40 |
goto fail; |
41 |
} |
42 |
#endif |
43 |
-#endif |
44 |
} |
45 |
|
46 |
/* set in-kernel socket buffer size */ |