Add keepalive, set_keepalive to TcpStream implementations#154025
Add keepalive, set_keepalive to TcpStream implementations#154025yungcomputerchair wants to merge 4 commits intorust-lang:mainfrom
keepalive, set_keepalive to TcpStream implementations#154025Conversation
|
r? @joboet rustbot has assigned @joboet. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
As a new contributor, there were a few things I wasn't sure about:
Thanks :) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
You'll need to put forward an API change proposal.
You can create one after the ACP is accepted.
Yup, that's all that's necessary for library features.
Yeah, that should be fine.
These platforms don't support running the test suites, so unfortunately no. These are tier 3 though, so it's fine if things don't work out – the target maintainers are responsible for keeping things working. It's always a good idea (and very polite) to run ./x check library/std --target x86_64-unknown-hermit(or |
|
Thanks for the quick and concise responses! I'll check those tier 3s and fill out an ACP. |
|
I have filed an ACP: rust-lang/libs-team#762 |
|
My ACP has been approved; let me know if there are any other steps left for me to take. |
What
The current implementation of
TcpStreamdoes not exposeSO_KEEPALIVE: #69774Why
It seems the reason this has not yet been implemented is because the initial implementation went as far as to take the keepalive interval as a parameter. However, Windows does not directly expose these intervals for reading, causing there to be some debate about the shape of the API (see the discussion of this here).
How
I am proposing that this API is enabled with a
boolparameter to align with the implementation in both Windows and Unix, as it is the least common denominator between the two of them. With regards to the call tosetsockopt, Windows expects a disable/enable, and Unix does as well.The extra configuration for Unix that allows the interval to be tweaked could be done through an additional API perhaps, but I don't think that's stopping us from exposing the switch to at least enable the behavior with the OS defaults.