mirror of
https://github.com/curl/curl.git
synced 2025-03-01 15:15:34 +08:00
connect: use TCP_KEEPALIVE only if TCP_KEEPIDLE is not defined
Closes #8539
This commit is contained in:
parent
f7d9a76ca7
commit
2cd9837e02
@ -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…
Reference in New Issue
Block a user