-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
WriteControl() changes WriteDeadline permanently #841
Comments
The network connection's A bug this severe seemed unlikely in this popular package. I found the information above by searching for |
The deadline default value is interesting. It is idiomatic in Go to use a zero time value to specify no deadline. The WriteControl method uses the zero time value to specify a deadline 1000 hours in the future. There's not a practical difference between no deadline and a deadline 1000 hours in the future, so this is not something that will have an impact on applications. It is strange. |
The bug isn't that they don't... the bug is that all
|
The solution is to change the documentation but also accept that accepting a write deadline in the write helper function was unnecessary, let the developer use SetWriteDeadline. Explicit is good. |
The package works as currently documented. The websocket connection The The documented deadline is used in both code paths.
|
Also, documenting a poor design decision does NOT qualify it as a feature. |
Why is this tagged as a bug and still open? This was already explained in:
The other issue about 0 deadline being 1000 hours is weird, but that'd be a separate issue (#895). |
Thanks for the comment @JannikGM, I'll close this one out, but agree based on the feedback in this thread that the behaviour is unexpected. |
Unexpected? Deadline management works as documented and would be useless if it worked the way OP assumes that it does. |
I was referring to
Thanks |
Sorry. Yes, that is weird. |
I will, later, dig out more information to support this.
https://github.com/gorilla/websocket/blob/9111bb834a68b893cebbbaed5060bdbc1d9ab7d2/conn.go#L463C4-L463C35
The issue here that the documentation implies that the deadline is set for this one message, whereas it actually calls
SetWriteDeadline()
and changes the deadline for all subsequent writes as well. It also uses a non-documented default value if supplied time zero&time.Time{}
so you should expect this function to change your configuration.The text was updated successfully, but these errors were encountered: