switch to boost::asio

This commit is contained in:
badaix 2019-09-28 21:28:54 +02:00
parent 08d0ce58f2
commit ec3f8d8ad5
16 changed files with 70 additions and 56 deletions

View file

@ -29,7 +29,7 @@ using namespace std;
using json = nlohmann::json;
StreamServer::StreamServer(asio::io_context* io_context, const StreamServerSettings& streamServerSettings)
StreamServer::StreamServer(boost::asio::io_context* io_context, const StreamServerSettings& streamServerSettings)
: io_context_(io_context), acceptor_v4_(nullptr), acceptor_v6_(nullptr), settings_(streamServerSettings)
{
}
@ -784,14 +784,14 @@ void StreamServer::start()
try
{
acceptor_v6_ = make_shared<tcp::acceptor>(*io_context_, endpoint_v6);
error_code ec;
acceptor_v6_->set_option(asio::ip::v6_only(false), ec);
asio::ip::v6_only option;
boost::system::error_code ec;
acceptor_v6_->set_option(boost::asio::ip::v6_only(false), ec);
boost::asio::ip::v6_only option;
acceptor_v6_->get_option(option);
is_v6_only = option.value();
LOG(DEBUG) << "IPv6 only: " << is_v6_only << "\n";
}
catch (const asio::system_error& e)
catch (const boost::system::system_error& e)
{
LOG(ERROR) << "error creating TCP acceptor: " << e.what() << ", code: " << e.code() << "\n";
}
@ -803,7 +803,7 @@ void StreamServer::start()
{
acceptor_v4_ = make_shared<tcp::acceptor>(*io_context_, endpoint_v4);
}
catch (const asio::system_error& e)
catch (const boost::system::system_error& e)
{
LOG(ERROR) << "error creating TCP acceptor: " << e.what() << ", code: " << e.code() << "\n";
}