Skip to content

Commit

Permalink
websocketserver: Retry listen on IPv4 if IPv6 is not available
Browse files Browse the repository at this point in the history
Fixes #1311
  • Loading branch information
tt2468 committed May 28, 2023
1 parent ac00465 commit 6434c42
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/websocketserver/WebSocketServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ void WebSocketServer::Start()
} else {
blog(LOG_INFO, "[WebSocketServer::Start] Not locked to IPv4 bindings");
_server.listen(conf->ServerPort, errorCode);
if (errorCode && errorCode == websocketpp::lib::asio::error::address_family_not_supported) {
blog(LOG_INFO, "[WebSocketServer::Start] IPv6 address family not supported, binding only to IPv4");
_server.listen(websocketpp::lib::asio::ip::tcp::v4(), conf->ServerPort, errorCode);
}
}

if (errorCode) {
Expand Down

0 comments on commit 6434c42

Please sign in to comment.