Skip to content

fix stuck in reading state#85

Closed
valkum wants to merge 1 commit intodjc:mainfrom
valkum:fix-read
Closed

fix stuck in reading state#85
valkum wants to merge 1 commit intodjc:mainfrom
valkum:fix-read

Conversation

@valkum
Copy link
Copy Markdown
Contributor

@valkum valkum commented Feb 20, 2026

The state machine for reading uses three states. Writing, Read Length and Reading.
Read length will set up the reading state with the expected length and the already read bytes (header).
In the reading state, if not enough bytes have been read from the connection, the state machine stays in the reading state.

The reading state failed to return the proper state. It reused the state var and thus never propagated the updated read var (which is owned in the scope). Everytime, the loop entered the transition from the Reading state, read was fixed to the initialized value from the Reading Length state. This caused the connection to be stuck for large responses (for example a <check> with over 20 domains).

We now emit a new Reading state with updated values.

The state machine for reading uses three states. `Writing`, `Read
Length` and `Reading`. Read length will set up the reading state with
the expected length and the already read bytes (header). In the reading
state, if not enough bytes have been read from the connection, the state
machine stays in the reading state.

The reading state failed to return the proper state. It reused the
`state` var and thus never propagated the updated read var (which is
owned in the scope). Everytime, the loop entered the transition from the
`Reading` state, `read` was fixed to the initialized value from the
`Reading Length` state. This caused the connection to be stuck for large
responses (for example a `<check>` with over 20 domains).

We now emit a new `Reading` state with updated values.
@valkum
Copy link
Copy Markdown
Contributor Author

valkum commented Feb 20, 2026

Nevermind, just saw #84.

@valkum valkum closed this Feb 20, 2026
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