-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-34932: Add socket.TCP_KEEPALIVE for macOS #25079
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update Doc/library/socket.rst first and I don't prefer to add TCP_KEEPALIVE as alias.
Modules/socketmodule.c
Outdated
PyModule_AddIntMacro(m, TCP_KEEPIDLE); | ||
#elif defined(__APPLE__) && defined(TCP_KEEPALIVE) | ||
/* TCP_KEEPALIVE is equivalent to TCP_KEEPIDLE on OSX. */ | ||
PyModule_AddIntConstant(m, "TCP_KEEPIDLE", TCP_KEEPALIVE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyModule_AddIntConstant(m, "TCP_KEEPIDLE", TCP_KEEPALIVE); | |
PyModule_AddIntMacro(m, TCP_KEEPALIVE);; |
Modules/socketmodule.c
Outdated
PyModule_AddIntMacro(m, TCP_KEEPIDLE); | ||
#elif defined(__APPLE__) && defined(TCP_KEEPALIVE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#elif defined(__APPLE__) && defined(TCP_KEEPALIVE) | |
#if defined(TCP_KEEPALIVE) |
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Noted. I've removed the alias and added TCP_KEEPALIVE directly. |
@corona10 Is there a reason you suggested to remove the
I have no idea what TCP_KEEPALIVE does on Windows. Should I:
|
After reading https://bugs.python.org/issue32394 to figure out why TestMSWindowsTCPFlags exists, I discovered that TCP_KEEPALIVE is undocumented on Windows: Since we don't know what version of windows introduced this flag we cannot add it on Windows. I've updated the code to only add TCP_KEEPALIVE on macOS (when it exists). |
I have made the requested changes; please review again. |
Thanks for making the requested changes! @corona10: please review the changes made to this pull request. |
ping @corona10 |
Rebased on to main. |
@corona10 @pablogsal I'm not sure what's holding up the review on this PR but I'm hoping it can be merged and backported to 3.10 similar to #25992. |
Thanks @ShaneHarvey for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
(cherry picked from commit d59d737) Co-authored-by: Shane Harvey <shnhrv@gmail.com>
GH-27153 is a backport of this pull request to the 3.10 branch. |
Thanks all! |
Thanks for your contribution! |
This change adds socket.TCP_KEEPALIVE for macOS.
https://bugs.python.org/issue34932