Enabled SO_REUSEADDR for server sockets.

This commit is contained in:
casey langen 2018-01-31 20:13:12 -08:00
parent 084f888d14
commit c1a0708089
2 changed files with 2 additions and 0 deletions

View File

@ -298,6 +298,7 @@ bool HttpServer::Start() {
MHD_OPTION_UNESCAPE_CALLBACK,
&HttpServer::HandleUnescape,
this,
MHD_OPTION_LISTENING_ADDRESS_REUSE, 1,
MHD_OPTION_END);
this->running = (httpServer != nullptr);

View File

@ -175,6 +175,7 @@ void WebSocketServer::ThreadProc() {
prefs::use_ipv6.c_str(), defaults::use_ipv6);
wss->init_asio();
wss->set_reuse_addr(true);
wss->set_message_handler(std::bind(&WebSocketServer::OnMessage, this, wss.get(), ::_1, ::_2));
wss->set_open_handler(std::bind(&WebSocketServer::OnOpen, this, ::_1));
wss->set_close_handler(std::bind(&WebSocketServer::OnClose, this, ::_1));