aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorRobert Wruck <rwruck@users.sf.net>2013-04-08 23:13:05 +0200
committerDaniel Stenberg <daniel@haxx.se>2013-04-08 23:13:05 +0200
commit29fdb2700f7979e71b8828c18e0e157a44b6db53 (patch)
tree18d7ef5a26bdee0fb7859664fc9d3e9498e57ed4 /lib/connect.c
parent32144ca2411d9ab9a9e907598cca7e89f99a6e55 (diff)
tcpkeepalive: Support CURLOPT_TCP_KEEPIDLE on OSX
MacOS X doesn't have TCP_KEEPIDLE/TCP_KEEPINTVL but only a single TCP_KEEPALIVE (see http://developer.apple.com/library/mac/#DOCUMENTATION/Darwin/Reference/ManPages/man4/tcp.4.html). Here is a patch for CURLOPT_TCP_KEEPIDLE on OSX platforms.
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/connect.c b/lib/connect.c
index e159a2b5c..6090abb36 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -148,6 +148,15 @@ tcpkeepalive(struct SessionHandle *data,
infof(data, "Failed to set TCP_KEEPINTVL on fd %d\n", sockfd);
}
#endif
+#ifdef TCP_KEEPALIVE
+ /* Mac OS X style */
+ optval = curlx_sltosi(data->set.tcp_keepidle);
+ KEEPALIVE_FACTOR(optval);
+ if(setsockopt(sockfd, IPPROTO_TCP, TCP_KEEPALIVE,
+ (void *)&optval, sizeof(optval)) < 0) {
+ infof(data, "Failed to set TCP_KEEPALIVE on fd %d\n", sockfd);
+ }
+#endif
#endif
}
}