feat(wasip3): implement wasi:sockets#11291
Merged
alexcrichton merged 20 commits intobytecodealliance:mainfrom Jul 30, 2025
Merged
feat(wasip3): implement wasi:sockets#11291alexcrichton merged 20 commits intobytecodealliance:mainfrom
wasi:sockets#11291alexcrichton merged 20 commits intobytecodealliance:mainfrom
Conversation
22c03af to
cfeb70e
Compare
Member
Author
|
FYI: I'm currently working on reusing most of the socket utilities across p2 and p3 to avoid duplication |
e81d4fa to
d8c7a50
Compare
crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
Outdated
Show resolved
Hide resolved
Comment on lines
+16
to
+24
| fn get_socket_addr_check<T>(store: &Accessor<T, WasiSockets>) -> SocketAddrCheck { | ||
| store.with(|mut view| view.get().ctx.socket_addr_check.clone()) | ||
| } | ||
|
|
||
| async fn is_addr_allowed<T>( | ||
| store: &Accessor<T, WasiSockets>, | ||
| addr: SocketAddr, | ||
| reason: SocketAddrUse, | ||
| ) -> bool { | ||
| get_socket_addr_check(store)(addr, reason).await | ||
| } |
Member
There was a problem hiding this comment.
One thing we may want to keep an eye out for in the future is some sort of fast path here to avoid the Arc::clone in the typical case.
pull in `wasi:sockets` from WebAssembly/wasi-sockets#126 Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
56be6a4 to
ad674a2
Compare
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
prtest:full Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
ad674a2 to
2d23d4b
Compare
87cb14b to
b69e53c
Compare
b69e53c to
2d23d4b
Compare
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
6 tasks
alexcrichton
approved these changes
Jul 29, 2025
Member
There was a problem hiding this comment.
I had to update the REUSEADDR test a bit more and I'll file a follow-up issue for that (EDIT #11342), but otherwise this all looks good to me.
bongjunj
pushed a commit
to prosyslab/wasmtime
that referenced
this pull request
Oct 20, 2025
* chore(wasip3): update `wasi:sockets` WIT pull in `wasi:sockets` from WebAssembly/wasi-sockets#126 Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor: rearrange Ctx/View Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor: name modules after packages Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor: move `Network` to `p2` Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * feat(wasip3): implement `wasi:sockets` Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor: reuse socket utilities Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * test(wasip3): allow name resolution to fail Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * fix: expect macos-only var to be unused on other OSes Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor: whole buffer is written for UDP Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * undo non-blocking write Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * extract buf capacity const, refactor tcp receive Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * introduce container struct for TCP non-inherited opts Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * handle `listen` receiver close Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor: clean up Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * adapt to API changes prtest:full Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * refactor: check for listen receiver close each iteration Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> * Try to make test less flaky * Cut down on `#[cfg]` required for wasi:sockets * Fix test for real this time --------- Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net> Co-authored-by: Alex Crichton <alex@alexcrichton.com>
This file contains hidden or 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
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.
Implement
wasip3wasi:sockets.I've refactored
FutureWriter::writea little bit to allow for non-blocking sendRefs bytecodealliance/wasip3-prototyping#228
Closes bytecodealliance/wasip3-prototyping#226 (note the addition of yield from the guest)
I was not able to reproduce bytecodealliance/wasip3-prototyping#44 with:
on MacOS