Skip to content

report read readiness accurately for freshly bound UDP sockets#740

Merged
alexcrichton merged 1 commit intoWebAssembly:mainfrom
dicej:wasip2-udp-fresh-bound-read-readiness
Feb 13, 2026
Merged

report read readiness accurately for freshly bound UDP sockets#740
alexcrichton merged 1 commit intoWebAssembly:mainfrom
dicej:wasip2-udp-fresh-bound-read-readiness

Conversation

@dicej
Copy link
Contributor

@dicej dicej commented Feb 13, 2026

Previously, wasip2_udp.c would call wasi:sockets/udp#udp-socket.streams lazily as needed in e.g. sendto and recvfrom. However, it was not doing so when the socket was polled, which meant poll would indicate read readiness and return immediately even though there was nothing ready to read.

With this commit, we now create the stream when polling the socket, which allows us to actually wait for real read readiness.

This also adds trivial SO_ERROR support to udp_getsockopt.

Previously, `wasip2_udp.c` would call `wasi:sockets/udp#udp-socket.streams`
lazily as needed in e.g. `sendto` and `recvfrom`.  However, it was not doing so
when the socket was `poll`ed, which meant `poll` would indicate read readiness
and return immediately even though there was nothing ready to read.

With this commit, we now create the stream when polling the socket, which allows
us to actually wait for real read readiness.

This also adds trivial `SO_ERROR` support to `udp_getsockopt`.
@dicej dicej force-pushed the wasip2-udp-fresh-bound-read-readiness branch from d20381f to 9681c68 Compare February 13, 2026 21:48
@alexcrichton alexcrichton merged commit da4bd9a into WebAssembly:main Feb 13, 2026
28 checks passed
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.

2 participants