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
net: support TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT on newer Windows #65817
Comments
Change https://go.dev/cl/565495 mentions this issue: |
Looks like we will have to add some new constants, so this issue might need to be bumped up to a proposal. |
Can we put the new constants in internal/syscall/windows? |
If that is allowed, then it would make our work on this much easier, because we don't have to go through the proposal process. |
We can add anything we like to internal/syscall. |
This comment was marked as duplicate.
This comment was marked as duplicate.
We've come to a consensus that this feature can be done without exposing any new constants, so taking this issue out of the |
Change https://go.dev/cl/570077 mentions this issue: |
The net package currently uses windows.SupportFullTCPKeepAlive to know if TCP_KEEPIDLE, TCP_KEEPINTVL, and TCP_KEEPCNT are available. This function is a wrapper over the undocumented RtlGetNtVersionNumbers API, which tests if the Windows version is at least 10.0.16299. This approach artificially limits the use of TCP_KEEPCNT, which is available since Windows 10.0.15063. It also uses an undocumented API, which is not something we want to rely on. This CL removes windows.SupportFullTCPKeepAlive in favor of dedicated proves for each option which are not based on the Windows version. While here, remove some assertions in setKeepAliveCount. It is better to let the system decide if the value is valid or not. Updates #65817. Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64 Change-Id: I0fe70d46c8675eab06c0e4628cf68571b6e50b80 Reviewed-on: https://go-review.googlesource.com/c/go/+/570077 Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Change https://go.dev/cl/576435 mentions this issue: |
The method comment of TCPConn.SetKeepAlivePeriod had become obsolete and inaccurate since CL 565495 and CL 570077 were merged. For #65817 Change-Id: Ide99b2949676d452a505ba6fd634088f05c9df44 Reviewed-on: https://go-review.googlesource.com/c/go/+/576435 Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
In CL 542275, the implementation on
Windows
has a few limitations:TCP_KEEPCNT
is not supported.TCP_KEEPIDLE
andTCP_KEEPINTVL
cannot be set separately, they must be set together.go/src/net/tcpsock.go
Lines 121 to 127 in ff4e45f
These limitations come from SIO_KEEPALIVE_VALS that is used for TCP keep-alive on
Windows
inGo
currently. It's a relatively oldWinsock
API for setting up the TCP keep-alive mechanism. I've done some more in-depth research onWindows
and realized that we can do more things on some relatively newer versions ofWindows
usingsetsockopt
andgetsockopt
.TCP_KEEPIDLE
andTCP_KEEPINTVL
are available starting with Windows 10, version 1709.TCP_KEEPCNT
is available starting with Windows 10, version 1703. Therefore, we can reconcile the implementation onWindows 10, version 1709
and later versions with the implementations on UNIX's.Follows up #65809
References
The text was updated successfully, but these errors were encountered: