Core/Networking: Support IPv6

This commit is contained in:
Shauren
2024-11-12 13:54:43 +01:00
parent 280af85337
commit af4dcc93ed
14 changed files with 123 additions and 64 deletions

View File

@@ -22,6 +22,7 @@
#include "IpAddress.h"
#include "Log.h"
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ip/v6_only.hpp>
#include <atomic>
#include <functional>
@@ -88,6 +89,11 @@ public:
}
#endif
// v6_only is enabled on some *BSD distributions by default
// we want to allow both v4 and v6 connections to the same listener
if (_endpoint.protocol() == boost::asio::ip::tcp::v6())
_acceptor.set_option(boost::asio::ip::v6_only(false));
_acceptor.bind(_endpoint, errorCode);
if (errorCode)
{