fix(wasix): preserve nonblocking connect errors - #6858
Conversation
There was a problem hiding this comment.
馃煛 Changes recommended
It introduces new variants to the public virtual-net::NetworkError enum (a breaking API surface change) without corresponding versioning/release-note handling.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR improves nonblocking socket connect error reporting in WASIX by preserving and surfacing the underlying connect failure (e.g., ECONNREFUSED, ENETUNREACH, EHOSTUNREACH) instead of collapsing failures to ENOTCONN.
Changes:
- Extend virtual networking errors with
NetworkUnreachableandHostUnreachable, including IO error kind and OS error code mappings. - Map the new virtual-net errors to WASIX
Errnovalues (Netunreach,Hostunreach). - Update
sock_connect鈥檚 nonblocking path to read and return the socket鈥檚 latched last error onClosed/Failed, falling back toENOTCONNwhen none is recorded.
File summaries
| File | Description |
|---|---|
| lib/wasix/src/syscalls/wasix/sock_connect.rs | Uses the socket鈥檚 latched last_error() to return the real connect failure for nonblocking connects. |
| lib/wasix/src/net/mod.rs | Maps new NetworkError variants to WASIX Errno values. |
| lib/virtual-net/src/lib.rs | Introduces NetworkUnreachable/HostUnreachable and maps them to/from std::io::ErrorKind and relevant libc codes. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 馃憤 or 馃憥 to tell us if it's correct.
| /// The operation is not supported. | ||
| #[error("unsupported")] | ||
| Unsupported, | ||
| /// The network containing the remote host is not reachable. | ||
| #[error("network unreachable")] | ||
| NetworkUnreachable, | ||
| /// The remote host is not reachable. | ||
| #[error("host unreachable")] | ||
| HostUnreachable, |
There was a problem hiding this comment.
... oh. Right. Well that's fun ^^'
There was a problem hiding this comment.
virtual-net is not stable yet and breaking changes aren't unexpected. Indeed, with each release, we bump the minor.
2b2eae0 to
7a293fd
Compare
fa6e437 to
dad7861
Compare
Arshia001
left a comment
There was a problem hiding this comment.
Looks good to go as soon as we add tests for it in wasm_tests.
cb8180e to
8c2caa8
Compare
Preserve the underlying error when a nonblocking socket connection fails.