forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Udp #2
Closed
Closed
Udp #2
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The original provision was added to align with preview3 streams that may only fail once. However, after discussing with Dan Gohman, we came to the conclusion that a stream of result<> could do the trick fine too. Fixes: WebAssembly/wasi-sockets#22
There is no cross-platform way to know the distinction between them
and just document it to be always possible.
They were unnecessarily detailed and mostly have no standardized equivalent in POSIX, so wasi-libc will probably just map them all back into a single EOPNOTSUPP or EINVAL or ... EISCONN/ENOTCONN can be derived in wasi-libc based on context and/or by checking `remote-address`. For example, `shutdown` can only be called on connected sockets, so if it returns `invalid-state` it can be unambiguously mapped to ENOTCONN.
These stem from back when the entire wasi-sockets proposal was one big single thing. In this day and age, when an implementation doesn't want to support TCP and/or UDP, it can simply _not_ implement that interface, rather than returning an error at runtime.
There is a myriad of reasons why an argument might be invalid or an operation might be not supported. But there is few cross platform consistency in which of those error cases result in which error codes. The error codes that have been removed were fairly specific, but: - Were still missing error cases. So additional error codes would have needed to be created. - Implementations would have to bend over backwards to make it work cross platform, especially beyond just Win/Mac/Linux. - Didn't all have an equivalent in POSIX, so they would map back into a generic EINVAL anyways.
- Ad-hoc skeleton implementation of resources. - Add blocking wrappers around async operations.
Because I need the family for input validation. And the resulting code is more straightforward.
All platforms supported by wasmtime also support dualstack sockets.
…nto tcp-error-checking # Conflicts: # crates/test-programs/wasi-sockets-tests/src/bin/tcp_v4.rs # crates/test-programs/wasi-sockets-tests/src/bin/tcp_v6.rs # crates/test-programs/wasi-sockets-tests/src/lib.rs # crates/wasi/src/preview2/host/tcp.rs # crates/wasi/src/preview2/tcp.rs # crates/wasi/wit/deps/sockets/tcp.wit # crates/wasi/wit/deps/sockets/udp.wit
…lready been called
…nto tcp-error-checking # Conflicts: # crates/test-programs/wasi-sockets-tests/src/lib.rs # crates/wasi/src/preview2/host/network.rs # crates/wasi/src/preview2/host/tcp.rs # crates/wasi/src/preview2/tcp.rs
I suspect that these changes apply to any BSD platform, but I can't test that.
- This provides cross-platform behaviour for `ipv6-only` - This eliminates the syscall in `validate_address_family`
This is based on TCP implementation Signed-off-by: Roman Volosatovs <[email protected]>
This introduces quite a few changes compared to TCP, which should most probably be integrated there as well Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
Signed-off-by: Roman Volosatovs <[email protected]>
…nto tcp-error-checking # Conflicts: # crates/wasi-http/wit/deps/sockets/ip-name-lookup.wit # crates/wasi-http/wit/deps/sockets/network.wit # crates/wasi-http/wit/deps/sockets/tcp-create-socket.wit # crates/wasi-http/wit/deps/sockets/tcp.wit # crates/wasi-http/wit/deps/sockets/udp-create-socket.wit # crates/wasi-http/wit/deps/sockets/udp.wit # crates/wasi/src/preview2/host/network.rs # crates/wasi/src/preview2/host/tcp.rs # crates/wasi/wit/deps/sockets/ip-name-lookup.wit # crates/wasi/wit/deps/sockets/network.wit # crates/wasi/wit/deps/sockets/tcp-create-socket.wit # crates/wasi/wit/deps/sockets/tcp.wit # crates/wasi/wit/deps/sockets/udp-create-socket.wit # crates/wasi/wit/deps/sockets/udp.wit
On UDP sockets, `connect` never blocks.
…smtime into udp # Conflicts: # crates/test-programs/wasi-sockets-tests/src/bin/tcp_v4.rs # crates/test-programs/wasi-sockets-tests/src/bin/tcp_v6.rs # crates/test-programs/wasi-sockets-tests/src/lib.rs # crates/wasi/src/preview2/host/tcp.rs
412347e
to
726bb92
Compare
Thank you, merged locally! |
rvolosatovs
pushed a commit
that referenced
this pull request
Oct 11, 2023
…dealliance#7029) * Rename `Host*` things to avoid name conflicts with bindings. * Update to the latest resource-enabled wit files. * Adapting the code to the new bindings. * Update wasi-http to the resource-enabled wit deps. * Start adapting the wasi-http code to the new bindings. * Make `get_directories` always return new owned handles. * Simplify the `poll_one` implementation. * Update the wasi-preview1-component-adapter. FIXME: temporarily disable wasi-http tests. Add logging to the cli world, since stderr is now a reseource that can only be claimed once. * Work around a bug hit by poll-list, fix a bug in poll-one. * Comment out `test_fd_readwrite_invalid_fd`, which panics now. * Fix a few FIXMEs. * Use `.as_ref().trapping_unwrap()` instead of `TrappingUnwrapRef`. * Use `drop_in_place`. * Remove `State::with_mut`. * Remove the `RefCell` around the `State`. * Update to wit-bindgen 0.12. * Update wasi-http to use resources for poll and I/O. This required making incoming-body and outgoing-body resourrces too, to work with `push_input_stream_child` and `push_output_stream_child`. * Re-enable disabled tests, remove logging from the worlds. * Remove the `poll_list` workarounds that are no longer needed. * Remove logging from the adapter. That said, there is no replacement yet, so add a FIXME comment. * Reenable a test that now passes. * Remove `.descriptors_mut` and use `with_descriptors_mut` instead. Replace `.descriptors()` and `.descriptors_mut()` with functions that take closures, which limits their scope, to prevent them from invalid aliasing. * Implement dynamic borrow checking for descriptors. * Add a cargo-vet audit for wasmtime-wmemcheck. * Update cargo vet for wit-bindgen 0.12. * Cut down on duplicate sync/async resource types (#1) * Allow calling `get-directories` more than once (#2) For now `Clone` the directories into new descriptor slots as needed. * Start to lift restriction of stdio only once (bytecodealliance#3) * Start to lift restriction of stdio only once This commit adds new `{Stdin,Stdout}Stream` traits which take over the job of the stdio streams in `WasiCtxBuilder` and `WasiCtx`. These traits bake in the ability to create a stream at any time to satisfy the API of `wasi:cli`. The TTY functionality is folded into them as while I was at it. The implementation for stdin is relatively trivial since the stdin implementation already handles multiple streams reading it. Built-in impls of the `StdinStream` trait are also provided for helper types in `preview2::pipe` which resulted in the implementation of `MemoryInputPipe` being updated to support `Clone` where all clones read the same original data. * Get tests building * Un-ignore now-passing test * Remove unneeded argument from `WasiCtxBuilder::build` * Fix tests * Remove some workarounds Stdio functions can now be called multiple times. * If `poll_oneoff` fails part-way through, clean up properly. Fix the `Drop` implementation for pollables to only drop the pollables that have been successfully added to the list. This fixes the poll_oneoff_files failure and removes a FIXME. --------- Co-authored-by: Alex Crichton <[email protected]>
rvolosatovs
pushed a commit
that referenced
this pull request
Feb 11, 2025
I missed this the first time around. Thanks to Roman for catching this and providing a test case. Fixes #2. Signed-off-by: Joel Dice <[email protected]>
rvolosatovs
pushed a commit
that referenced
this pull request
Feb 12, 2025
…codealliance#4) I missed this the first time around. Thanks to Roman for catching this and providing a test case. Fixes #2. Signed-off-by: Joel Dice <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
bytecodealliance#7148