Raise ClientDisconnected on send() when client disconnected#2220
Merged
Raise ClientDisconnected on send() when client disconnected#2220
ClientDisconnected on send() when client disconnected#2220Conversation
71c0a00 to
fd088ff
Compare
Kludex
commented
Feb 10, 2024
| self.scope, self.receive, self.send | ||
| ) | ||
| except ClientDisconnected: | ||
| ... |
Owner
Author
There was a problem hiding this comment.
Do I need to call the self.transport.close()?
Owner
Author
There was a problem hiding this comment.
Well... The connection_lost callback is called, and the transport is closed there.
Owner
Author
There was a problem hiding this comment.
Actually, not adding the self.transport.close() means that we maintain the same behavior as before (which is better).
Owner
Author
|
I'm going to add a test before merging, but review welcome. |
adriangb
reviewed
Feb 10, 2024
Contributor
adriangb
left a comment
There was a problem hiding this comment.
Looks good, just missing a test
| self.scope, self.receive, self.send | ||
| ) | ||
| except ClientDisconnected: | ||
| ... |
Contributor
There was a problem hiding this comment.
Suggested change
| ... | |
| pass |
I think is more common in this context?
aa46d41 to
c19dae7
Compare
Kludex
commented
Feb 11, 2024
| async def test_early_response( | ||
| http_protocol_cls: HTTPProtocol, | ||
| ): | ||
| async def test_disconnect_on_send(http_protocol_cls: HTTPProtocol) -> None: |
adriangb
approved these changes
Feb 12, 2024
ninoseki
added a commit
to ninoseki/uvicorn
that referenced
this pull request
Mar 16, 2024
3 tasks
Kludex
added a commit
that referenced
this pull request
Mar 19, 2024
* chore: revert #2220 * Don't revert the receive changes --------- Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We need to clarify this on django/asgiref@3f0147d before merging it.👆 Clarified.
Also, tests are missing here.