Skip to content

Conversation

@alexcrichton
Copy link
Member

This is the same as #11384 except for TcpSocket to share the implementation of TCP across WASIp{2,3} and avoid duplicating code between the two.

This is the same as bytecodealliance#11384 except for `TcpSocket` to share the
implementation of TCP across WASIp{2,3} and avoid duplicating code
between the two.
@alexcrichton alexcrichton requested a review from a team as a code owner August 6, 2025 14:37
@alexcrichton alexcrichton requested a review from a team as a code owner August 6, 2025 14:51
@alexcrichton alexcrichton requested review from dicej and removed request for a team August 6, 2025 14:51
@pchickey pchickey requested review from rvolosatovs and removed request for dicej August 6, 2025 16:15
@github-actions github-actions bot added the wasi Issues pertaining to WASI label Aug 6, 2025
Copy link
Member

@rvolosatovs rvolosatovs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit hard to keep track of all the changes, but I checked out the code locally to do a little overview and changes look good to me.

Is changing the wasip2 socket behavior a concern at all? (e.g. TcpSocket::new now returning "access denied")

Like UDP only perform the check on socket creation, not after it's
created.
@alexcrichton
Copy link
Member Author

It's an intentional change yeah as I think it makes more sense to gate creation of sockets rather than gate operations on the sockets since it consolidates the check into just one place instead of having it spread out. It's also non-standard behavior in the sense that it's not specified in WASI itself, so it should be ok to tweak it's behavior over time. While the error is shuffled around disabling TCP and/or UDP still has the same effect where you can't do anything TCP/UDP-related once the options are disabled.

@alexcrichton alexcrichton enabled auto-merge August 7, 2025 14:23
@alexcrichton alexcrichton added this pull request to the merge queue Aug 7, 2025
Merged via the queue into bytecodealliance:main with commit e83da48 Aug 7, 2025
44 checks passed
@alexcrichton alexcrichton deleted the wasi-sockets-tcp-refactor branch August 7, 2025 14:58
bongjunj pushed a commit to prosyslab/wasmtime that referenced this pull request Oct 20, 2025
* Use the same `TcpSocket` in WASIp{2,3}

This is the same as bytecodealliance#11384 except for `TcpSocket` to share the
implementation of TCP across WASIp{2,3} and avoid duplicating code
between the two.

* Fix CI issues

* Review comments

* Trim "TCP allowed?" checks

Like UDP only perform the check on socket creation, not after it's
created.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasi Issues pertaining to WASI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants