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

Don't panic when trying to close a connection in "Connecting" state #329

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zazabe
Copy link

@zazabe zazabe commented Sep 23, 2020

It's almost impossible to control the state of a WebSocket if there's a panic here (e.g. being able to start/stop a ws client or server).

We must control each connection state to decide how to close a connection to avoid this panic, and most important point, to shutdown the WebSocket.
ws::Sender::shutdown should never panic, because it's the only way to stop a running WebSocket, and we should not have to care about the state of connections.

It's not happening in release mode, but using this crate in tests seems to be a valid use-case.

Why not using an error log instead?

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.

1 participant