From 5b8a5c08ce28639e788734b2528faad70baa113c Mon Sep 17 00:00:00 2001 From: Sergey Kandaurov Date: Mon, 26 May 2025 16:11:36 +0400 Subject: 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. --- src/core/ngx_connection.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/core/ngx_connection.c') diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c index 75809d9ad..7cae295eb 100644 --- a/src/core/ngx_connection.c +++ b/src/core/ngx_connection.c @@ -765,6 +765,8 @@ ngx_configure_listening_sockets(ngx_cycle_t *cycle) #if (NGX_HAVE_KEEPALIVE_TUNABLE) +#if !(NGX_DARWIN) + if (ls[i].keepidle) { value = ls[i].keepidle; @@ -782,6 +784,8 @@ ngx_configure_listening_sockets(ngx_cycle_t *cycle) } } +#endif + if (ls[i].keepintvl) { value = ls[i].keepintvl; -- cgit v1.2.3