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

Do not use SO_REUSEADDR on Window by default #214

Open
eao197 opened this issue Mar 18, 2024 · 0 comments
Open

Do not use SO_REUSEADDR on Window by default #214

eao197 opened this issue Mar 18, 2024 · 0 comments

Comments

@eao197
Copy link
Member

eao197 commented Mar 18, 2024

RESTinio sets SO_REUSEADDR option in settings by default. But on Windows SO_REUSEADDR works differently than on Linux (and other Unixes AFAIK): on Windows SO_REUSEADDR allows to run two instances of RESTinio server on the same address. For more information see, for example, this and this.

So I think wa have to change the behaviour of create_default_unique_object_instance<acceptor_option_setter_t>:

create_default_unique_object_instance< acceptor_options_setter_t >()
{
return std::make_unique< acceptor_options_setter_t >(
[]( acceptor_options_t & options ){
options.set_option( asio_ns::ip::tcp::acceptor::reuse_address( true ) );
} );
}

The reuse_address should not be used on Windows.

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

No branches or pull requests

1 participant