Skip to content

Do not use SO_REUSEADDR on Window by default #214

@eao197

Description

@eao197

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions