Skip to content
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

websockets: Return from writer thread after close finished #20

Merged
merged 1 commit into from
Sep 28, 2019

Conversation

Jille
Copy link
Contributor

@Jille Jille commented Sep 23, 2019

When an interrupt arrived, the writer thread sends a CloseMessage, the reader thread receives confirmation and nicely shuts down, closing the done channel and the websocket. If that happens within one second, the writer thread needs to return rather than continuing in the loop. If that didn't happen within one second, only then it's useful for the writer thread to call c.Close() as well.

The most important fix is changing break to return, to avoid leaking the writer thread and having it fail every second.

When an interrupt arrived, the writer thread sends a CloseMessage, the reader thread receives confirmation and nicely shuts down, closing the done channel and the websocket. If that happens within one second, the writer thread needs to return rather than continuing in the loop. If that didn't happen within one second, only then it's useful for the writer thread to call c.Close() as well.

The most important fix is changing break to return, to avoid leaking the writer thread and having it fail every second.
@jrudio jrudio merged commit aa06dc3 into jrudio:master Sep 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants