diff --git a/src/syncServer.cpp b/src/syncServer.cpp index 1e6e352..5aeb197 100644 --- a/syncServer.cpp +++ b/syncServer.cpp @@ -48,6 +48,11 @@ #include "log.h" #include "anytunError.h" +#if BOOST_VERSION >= 107000 +#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context()) +#else +#define GET_IO_SERVICE(s) ((s).get_io_service()) +#endif //using asio::ip::tcp; SyncServer::SyncServer(std::string localaddr, std::string port, ConnectCallback onConnect) @@ -125,7 +130,7 @@ void SyncServer::start_accept() std::list::iterator it = acceptors_.begin(); for(; it != acceptors_.end(); ++it) { if(!it->started_) { - SyncTcpConnection::pointer new_connection = SyncTcpConnection::create(it->acceptor_->get_io_service()); + SyncTcpConnection::pointer new_connection = SyncTcpConnection::create(GET_IO_SERVICE(*it->acceptor_)); conns_.push_back(new_connection); it->acceptor_->async_accept(new_connection->socket(), boost::bind(&SyncServer::handle_accept, this, new_connection, boost::asio::placeholders::error, it));