-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasi-sockets: Add network-error-code
#9276
Conversation
7411bf1
to
731ce8a
Compare
Thanks for this! Before I think too hard about a unit test though this PR is the unfortunate victim of "first proposal to add WITs with I say that this is an "unfortunate victim" because this infrastructure hasn't been built yet. Ideally what needs to happen I think is that the calls to From a technical perspective though this PR otherwise looks good to me. Would you be up for helping out with the infrastructure for plumbing flags through? |
I'll give it a try |
Do you have any preference on how to thread through the feature names down into the generated code? I have three suggestions so far:
|
I'd recommend the |
I'm attempting to only generate the new parameter on add_to_linker if the bindgen config specifies unstable features. I'm running into a problem when the wasmtime/crates/wasi/src/bindings.rs Lines 161 to 166 in 9fc41ba
Within the bindgen macro I don't know for which of those interfaces I need to forward the One way to make it work is to simply unconditionally add the parameter to every generated add_to_linker function, regardless of wheter its needed or not. But that will be a backwards incompatible change. Suggestions? |
IIRC there are per-interface Even when |
If every interface defines its own fresh options type, then a bindgen! using So the example from above would produce
|
I might bikeshed to a |
For the world that could work. But I'm specifically concerned here about the |
Could you detail a bit more how One possible piece perhaps is that I'm thinking now that Wasmtime might want to unconditionally always use |
You're right. I've got it working in: #9381 |
…imilar to the existing filesystem-error-code and http-error-code functions.
731ce8a
to
5b3cfa1
Compare
I've updated the PR with the latest main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Implements WebAssembly/wasi-sockets#105
This function downcasts a stream error to a network-related error.
Similar to the existing
filesystem-error-code
andhttp-error-code
functions.Unit test is missing because I couldn't figure out a reliable way to fail a TCP stream mid-connection. Suggestions are welcome.