x/net/tcp: shouldn't SetKeepAlive() and SetKeepAlivePeriod() be flagged as deprecated or at least be flagged as conflicting with SetKeepAliveConfig #73401
Labels
LibraryProposal
Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool
Milestone
Go version
go1.24.1
Output of
go env
in your module/workspace:What did you do?
Hi,
I had a weird time fighting go default tcp keepalive for a service that is connecting IoT devices to a go-based server.
No amount of SetKeepAlive(false) or SetKeepAlive(300) was doing anything to solve my issue and it's only after quite a lot of failures that i fell upon the https://pkg.go.dev/net#ListenConfig structure definition and the following excerpt:
This lead me to replacing
SetKeepAlive(false)
with.SetKeepAliveConfig(net.KeepAliveConfig{Enable: false})
and that started to actually do something.So given that apparently the default keepalive is set using this new mechanism we shoud mark the old function as deprecated or at least add a big warning of the interaction with SetKeepAliveConfig() in the SetKeepAlive()/SetKeepAlivePeriod() definition ?
What did you see happen?
SetKeepAlive/SetKeepAlivePeriod did not have any effect on the keepalive mechanism and there was no direct documentation on the function definition that helped identify the "conflict" with the KeepAliveConfig structure/settings
What did you expect to see?
SetKeepAlive/SetKeepAlivePeriod doc should include a warning or flag the function as deprecated
The text was updated successfully, but these errors were encountered: