mirror of
https://github.com/curl/curl.git
synced 2026-04-15 11:51:41 +03:00
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.
This commit is contained in:
parent
32144ca241
commit
29fdb2700f
1 changed files with 9 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue