-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(wasip3): implement wasi:sockets
#11291
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
feat(wasip3): implement wasi:sockets
#11291
Conversation
22c03af to
cfeb70e
Compare
|
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
| 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 | ||
| } |
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.
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>
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.
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.
* 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>
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