Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.16k stars 93 forks source link

Do not use SO_REUSEADDR on Window by default #214

Open eao197 opened 8 months ago

eao197 commented 8 months ago

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>: https://github.com/Stiffstream/restinio/blob/7994a15e64d28975fb05b5b483f9271bab38145b/dev/restinio/settings.hpp#L229-L235

The reuse_address should not be used on Windows.