Repository navigation
Conversation
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.
What
In
{active, once}mode,hackney_wsswitches the socket to passive after the first TCP read, even when that read held only part of a frame. The partial frame is buffered but never delivered, and the connection stalls: the owner has received no message, so it has no reason to callws_setopts/2again. With this change, a read that completes no frame re-arms the socket with{active, once}, and reading continues until a whole frame can be delivered.Why
A frame larger than one TCP read (for example a 1 MiB binary message, or any message spanning several TLS records) cannot be received in
{active, once}mode, which is the mode that gives a client backpressure.How to test
rebar3 eunit --module=hackney_ws_testsruns the new "Active mode once with a frame split across reads" test, which asks the mock server for a 1 MiB frame in{active, once}mode. It fails without the change and passes with it. The fullrebar3 eunitsuite (1,382 tests) passes.