-
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
SetReadDeadline and Concurrency #338
Comments
The SetReadDeadline method can be called concurrently in the current implementation. Do you need to call it concurrently, and if so, why? |
I want to extend the read deadline on both, incoming application messages and pongs, and they happen to be handled on separate routines. |
Is there a reason why you cannot extend the deadline from the reading goroutine? |
I meant to say from the pong and reading routines. IIUC the websocket connection state can become permanently corrupted if a read op times out, so I am just trying to minimize that. However, I do want the connection to tell me something is wrong if I haven't heard from the client for a while either from pongs or regular messages. |
The pong handler is called from the reading goroutine and can set the deadline. |
I didn't realize the pong handler is called from |
The overview documentation says:
I'll repeat this in the SetPing/Pong/CloseHandler documentation. |
I overlooked that (my bad). Adding the extra comment sounds great. Thanks Gary! |
Hi,
The Concurrency section of the documentation lists the read-related methods that should only be called by one routine. I am just wondering why SetReadDeadline is listed in there as it only seems to call the respective net.Conn method, which is supposedly safe for multi-routine use.
Thanks in advance,
Rod
The text was updated successfully, but these errors were encountered: