bytecodealliance/jco

wasi-sockets: New SO_REUSEADDR test

Closed this issue · 3 comments

Just a heads up; I've clarified in the WITs that SO_REUSEADDR should be set on TCP sockets by default when performing an explicit bind. I've added a new test for it over in the wasmtime repo: bytecodealliance/wasmtime#7690

I don't think this requires any additional work in JCO, because libuv appears to already do this for you.

Thanks for the heads-up 👍

Thanks for the clarification here. I was wondering @badeend if you had any ideas why we need to separately track the global address registrations for the test_tcp_bind_addrinuse test? If anything comes to mind would value your thoughts.

I managed to trace the issue with the global address registration down to a Node.js low-level bindgen calling convention, with a weird workaround, where Node.js needs to call getsockname to extract bind errors, so I just followed how it is done in core to resolve this - https://github.com/nodejs/node/blob/main/lib/net.js#L1011.