Skip to content

Fix infinite loop when a Websocket connection is lost #58

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

Merged
merged 1 commit into from
Nov 24, 2019

Conversation

quentin
Copy link
Contributor

@quentin quentin commented Nov 17, 2019

When a client closes a Websocket connection without performing a clean closing hand-shake, the server enters an infinite loop. This happens when the client web-browser is killed. I noticed this behaviour when swiping out Chrome on Android.

The suggested change might not be the best fix possible, but it works.

@fhessel fhessel self-requested a review November 17, 2019 14:06
@fhessel
Copy link
Owner

fhessel commented Nov 17, 2019

Thank you for your contributions, I'll review them as soon as possible. The WebSocket implementation is still quite experimental, so there might be (or probably will be) more issues with it.

Copy link
Owner

@fhessel fhessel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could reproduce the problem (using a smartphone and killing the Browser was a good hint) and verify that your suggestion fixes it, so I'd say: Approved!

It might indeed not be an optimal solution to handle the client state in that place, as that is also done at the beginning of the loop() function (here to be precise), but the Websockets in general need some refactoring, so I think that's good for now.

@fhessel fhessel merged commit f80b961 into fhessel:master Nov 24, 2019
@quentin quentin deleted the ws-lost-issue branch November 29, 2019 19:06
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