Skip to content

fix(netconn): return from zero-length reads without waiting - #601

Open
anishpentyala wants to merge 3 commits into
coder:masterfrom
anishpentyala:fix/netconn-zero-read
Open

anishpentyala wants to merge 3 commits into
coder:masterfrom
anishpentyala:fix/netconn-zero-read

Conversation

@anishpentyala

Copy link
Copy Markdown

A zero-length NetConn.Read currently waits for a WebSocket message on an idle connection, and keeps retrying if a message reader already has data. This returns (0, nil) without reading a message when the caller buffer is empty. Known EOF and expired-deadline errors keep their existing behavior.

The retry loop still skips empty WebSocket messages for nonempty caller buffers, preserving #367. Native tests cover nil and empty buffers on idle and buffered connections, confirm buffered bytes remain available, and exercise deadline reset and empty messages. A browser Wasm test covers idle and buffered connections too.

The native regression fails on the base commit in all four cases. The Wasm idle regression also fails on the base; the candidate passes the native race suite and real Chrome/Wasm tests. No API, dependencies, or framing changes.

Validation was on Linux. The full make test pipeline (including arm64/QEMU, examples, third-party tests and benchmarks), Autobahn, and other operating systems were not run.

A zero-length buffer cannot receive message data. Return without reading while preserving known EOF and expired-deadline errors, and keep skipping empty messages for nonempty buffers.
Cover nil and empty buffers on idle and buffered connections, plus deadline reset and empty-message skipping controls.
Check idle and buffered connections with nil and empty buffers while preserving the buffered message remainder.

This branch has not been deployed

No deployments
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