Skip to content

Core: added support for TCP keepalive parameters on macOS. #709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2025

Conversation

pluknet
Copy link
Contributor

@pluknet pluknet commented May 26, 2025

The support first appeared in OS X Mavericks 10.9 and is documented since OS X Yosemite 10.10, with two subtle implementation differences:

  • the TCP_KEEPIDLE socket option is available as TCP_KEEPALIVE;

  • socket options are not inhereted from the listen socket, they are explicitly set on the newly created socket upon accept.

Thanks to Andy Pan for initial work.

Closes #336.

@pluknet pluknet requested a review from arut May 26, 2025 12:33
@pluknet pluknet self-assigned this May 26, 2025
@pluknet pluknet force-pushed the darwin-keepalive branch 4 times, most recently from 85c0452 to 02fbe1b Compare May 26, 2025 17:20
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.
@pluknet pluknet force-pushed the darwin-keepalive branch from 02fbe1b to 8a75ac4 Compare May 26, 2025 17:33
Copy link
Contributor

@arut arut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@pluknet pluknet merged commit 5b8a5c0 into nginx:master May 26, 2025
1 check passed
@pluknet pluknet deleted the darwin-keepalive branch May 26, 2025 22:08
@Maryna-f5 Maryna-f5 added this to the nginx-1.29.0 milestone May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TCP keepalive on Darwin is overlooked and is not enabled on some platforms
3 participants