aboutsummaryrefslogtreecommitdiff
path: root/auto/unix
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2025-05-26 16:11:36 +0400
committerpluknet <pluknet@nginx.com>2025-05-27 01:59:02 +0400
commit5b8a5c08ce28639e788734b2528faad70baa113c (patch)
treefd3f3029d17f3f15913db39d017651c0996acb78 /auto/unix
parent3d5889a3ee41a282bad54d9c0d3662dba9f52c1b (diff)
downloadnginx-5b8a5c08ce28639e788734b2528faad70baa113c.tar.gz
nginx-5b8a5c08ce28639e788734b2528faad70baa113c.zip
Core: added support for TCP keepalive parameters on macOS.
The support first appeared in OS X Mavericks 10.9 and documented since OS X Yosemite 10.10. It has a subtle implementation difference from other operating systems in that the TCP_KEEPALIVE socket option (used in place of TCP_KEEPIDLE) isn't inherited from a listening socket to an accepted socket. An apparent reason for this behaviour is that it might be preserved for the sake of backward compatibility. The TCP_KEEPALIVE socket option is not inherited since appearance in OS X Panther 10.3, which long predates two other TCP_KEEPINTVL and TCP_KEEPCNT socket options. Thanks to Andy Pan for initial work.
Diffstat (limited to 'auto/unix')
-rw-r--r--auto/unix26
1 files changed, 14 insertions, 12 deletions
diff --git a/auto/unix b/auto/unix
index 8bd1b1370..0dd66cfcd 100644
--- a/auto/unix
+++ b/auto/unix
@@ -508,18 +508,20 @@ ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_DEFER_ACCEPT, NULL, 0)"
. auto/feature
-ngx_feature="TCP_KEEPIDLE"
-ngx_feature_name="NGX_HAVE_KEEPALIVE_TUNABLE"
-ngx_feature_run=no
-ngx_feature_incs="#include <sys/socket.h>
- #include <netinet/in.h>
- #include <netinet/tcp.h>"
-ngx_feature_path=
-ngx_feature_libs=
-ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_KEEPIDLE, NULL, 0);
- setsockopt(0, IPPROTO_TCP, TCP_KEEPINTVL, NULL, 0);
- setsockopt(0, IPPROTO_TCP, TCP_KEEPCNT, NULL, 0)"
-. auto/feature
+if test -z "$NGX_KEEPALIVE_CHECKED"; then
+ ngx_feature="TCP_KEEPIDLE"
+ ngx_feature_name="NGX_HAVE_KEEPALIVE_TUNABLE"
+ ngx_feature_run=no
+ ngx_feature_incs="#include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>"
+ ngx_feature_path=
+ ngx_feature_libs=
+ ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_KEEPIDLE, NULL, 0);
+ setsockopt(0, IPPROTO_TCP, TCP_KEEPINTVL, NULL, 0);
+ setsockopt(0, IPPROTO_TCP, TCP_KEEPCNT, NULL, 0)"
+ . auto/feature
+fi
ngx_feature="TCP_FASTOPEN"