Skip to content
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

Document SO_REUSEADDR to be the default for TCP bind #87

Merged
merged 3 commits into from
Jan 3, 2024

Conversation

badeend
Copy link
Collaborator

@badeend badeend commented Jan 3, 2024

For TCP sockets specifically, this is a reasonable default for WASI to recommend:


This is the behavior as implemented by Wasmtime and JCO.

@badeend
Copy link
Collaborator Author

badeend commented Jan 3, 2024

@sunfishcode Do you agree?

Copy link
Member

@sunfishcode sunfishcode left a comment

Choose a reason for hiding this comment

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

This sounds reasonable to me. If we encounter a use case where someone specifically wants SO_REUSEADDR disabled, we can evolve by adding methods to explicitly set/get that flag (which might just fail on Windows).

imports.md Outdated
<h1>Implementors note</h1>
<p>When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT
state of a recently closed socket on the same local address (i.e. the SO_REUSEADDR socket
option should be set implicitly on platforms that require it).</p>
Copy link
Member

Choose a reason for hiding this comment

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

It looks like Windows' SO_REUSEADDR has different and undesirable behavior so it'd be good to call out that this advice doesn't apply on Windows.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done!

@badeend badeend merged commit 7b7b7da into WebAssembly:main Jan 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants