| 00dd6681 | 06-Aug-2025 |
Alex Crichton <[email protected]> |
Use the same `UdpSocket` in WASIp{2,3} (#11384)
* Use the same `UdpSocket` in WASIp{2,3}
This commit refactors the implementation of `wasi:sockets` for WASIp2 and WASIp3 to use the same underlying
Use the same `UdpSocket` in WASIp{2,3} (#11384)
* Use the same `UdpSocket` in WASIp{2,3}
This commit refactors the implementation of `wasi:sockets` for WASIp2 and WASIp3 to use the same underlying host data structure for the `UdpSocket` resource in WIT. Previously each version of WASI had its own socket which resulted in duplicated code. There's some minor differences between WASIp2 and WASIp3 but it's easy enough to paper over with the same socket type. This is intended to help with the maintainability of this going forward to only have one type to operate on rather than two (which also ensures that bugfixes for one should affect the other).
One other change made in this commit is that sprinkled checks for whether or not UDP is allowed are all removed and canonicalized during UDP socket creation. This means that UDP socket creation is the only location that checks for whether UDP is allowed. Once a UDP socket is created it can be used freely regardless of whether the UDP setting is enabled or disabled. This is not intended to have a large practical effect but it does mean the behavior of hosts that deny UDP but manually give access to a UDP socket resource to a component may behave subtly differently.
* Review comments
* Fix p3-less warnings
* Update UDP denial test
* Fix some clippy issues
* Fix no-udp test warnings
show more ...
|