Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check if handshake is completed before sending frame on wsproto shutdown #1737
Check if handshake is completed before sending frame on wsproto shutdown #1737
Changes from 4 commits
0cc0e01
608e38d
c4bfc3d
e4aae0b
61f4483
6f3d8dc
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test actually fails on the
websockets
implementation.This fails before and after my changes, so it is actually not this PR who broke it.
There's a single small change on the
websockets
implementation on this PR, which actually handles the next test.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to match the behavior on both implementations.
If we close the connection on
shutdown
, we should be sending 1012.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the core here.
We want to check if the handshake was completed, because
CloseConnection
is not a valid event forwsproto.WSConnection.send()
when the handshake is not completed.This is the error these lines solve:
More about it on #596.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. 馃憤
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is... If the above is
False
, we still need to send something to the client, otherwise we are being rude. 馃槥Without these lines, the client will have a:
With these lines:
The curl command used was:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much neater. 馃槍
I did spend some time trying to figure out if we should we also include a textual description here, but I think it's probably okay as it currently stands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are analogous. Just making it more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary on this scenario, because the transport was closed on the
shutdown()
, it can also be that the client disconnected before accepting the connection...