mirror of
https://github.com/curl/curl.git
synced 2026-04-15 03:21:41 +03:00
connect: use TCP_KEEPALIVE only if TCP_KEEPIDLE is not defined
Closes #8539
This commit is contained in:
parent
f7d9a76ca7
commit
2cd9837e02
1 changed files with 8 additions and 9 deletions
|
|
@ -137,6 +137,14 @@ tcpkeepalive(struct Curl_easy *data,
|
|||
(void *)&optval, sizeof(optval)) < 0) {
|
||||
infof(data, "Failed to set TCP_KEEPIDLE on fd %d", sockfd);
|
||||
}
|
||||
#elif defined(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", sockfd);
|
||||
}
|
||||
#endif
|
||||
#ifdef TCP_KEEPINTVL
|
||||
optval = curlx_sltosi(data->set.tcp_keepintvl);
|
||||
|
|
@ -146,15 +154,6 @@ tcpkeepalive(struct Curl_easy *data,
|
|||
infof(data, "Failed to set TCP_KEEPINTVL on fd %d", 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", sockfd);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue