wasi-sockets: Allow implicit binds in 0.3#12225
wasi-sockets: Allow implicit binds in 0.3#12225alexcrichton merged 8 commits intobytecodealliance:mainfrom
Conversation
alexcrichton
left a comment
There was a problem hiding this comment.
Thanks for the comprehensive tests and the implementation here, much appreciated!
* Allow TCP `listen` to be called without an explicit `bind` on P3. * Allow UDP `connect` to be called without an explicit `bind` on P3. * Add test to verify that `receive` requires the socket to be bound. * Allow UDP `send` to be called on an unbound socket on P3. * Add feature flags * Add docs * Resolve "unused imports" warning
…ailure on Windows.
2d0d4e8 to
b9668c6
Compare
|
Interesting. I was under the impression that implicit bind was a well-known universal behavior, but after some more research it appears to be a bit more nuanced than I thought. I've added a comment in the code with my findings. But practically, Linux & MacOS both successfully ran to completion with: So they perform an implicit bind as expected (but not clearly documented). I assume this behavior extrapolates to other *BSD flavors. But apparently, Windows requires Assuming this actually fixes the CI problems, I'll open a PR for a spec change to add a clarification on the @alexcrichton Could you review the changes I just added? |
|
Sounds right to me yeah, and thanks for investigating! |
In 0.2, implicit binds were explicitly forbidden, because that would bypass the concept of network handles.
0.3 doesn't have network handles and sockets are allowed to perform implicit binds again. This affects:
tcp-socket::listen(documented here)udp-socket::connect(documented here)udp-socket::sendEventually, this will also allow us to remove the double bookkeeping like this from wasi-libc.