Add keepalive, set_keepalive to TcpStream implementations#154025
Open
yungcomputerchair wants to merge 3 commits intorust-lang:mainfrom
Open
Add keepalive, set_keepalive to TcpStream implementations#154025yungcomputerchair wants to merge 3 commits intorust-lang:mainfrom
keepalive, set_keepalive to TcpStream implementations#154025yungcomputerchair wants to merge 3 commits intorust-lang:mainfrom
Conversation
Collaborator
|
r? @joboet rustbot has assigned @joboet. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Author
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. 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.