diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/syncServer.cpp | 4 | ||||
-rw-r--r-- | src/syncTcpConnection.cpp | 8 | ||||
-rw-r--r-- | src/syncTcpConnection.h | 10 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/syncServer.cpp b/src/syncServer.cpp index 1e6e352..21302c2 100644 --- a/src/syncServer.cpp +++ b/src/syncServer.cpp @@ -125,7 +125,11 @@ void SyncServer::start_accept() std::list<AcceptorsElement>::iterator it = acceptors_.begin(); for(; it != acceptors_.end(); ++it) { if(!it->started_) { +#if BOOST_VERSION >= 107000 + SyncTcpConnection::pointer new_connection = SyncTcpConnection::create(it->acceptor_->get_executor()); +#else SyncTcpConnection::pointer new_connection = SyncTcpConnection::create(it->acceptor_->get_io_service()); +#endif 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)); diff --git a/src/syncTcpConnection.cpp b/src/syncTcpConnection.cpp index 027c775..9fe3dba 100644 --- a/src/syncTcpConnection.cpp +++ b/src/syncTcpConnection.cpp @@ -66,10 +66,18 @@ void SyncTcpConnection::Send(std::string message) boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } + +#if BOOST_VERSION >= 107000 +SyncTcpConnection::SyncTcpConnection(const boost::asio::executor& executor) + : socket_(executor) +{ +} +#else SyncTcpConnection::SyncTcpConnection(boost::asio::io_service& io_service) : socket_(io_service) { } +#endif void SyncTcpConnection::handle_write(const boost::system::error_code& /*error*/, size_t /*bytes_transferred*/) diff --git a/src/syncTcpConnection.h b/src/syncTcpConnection.h index a188610..d5f6ef1 100644 --- a/src/syncTcpConnection.h +++ b/src/syncTcpConnection.h @@ -60,9 +60,15 @@ public: typedef boost::shared_ptr<SyncTcpConnection> pointer; typedef boost::asio::ip::tcp proto; +#if BOOST_VERSION >= 107000 + static pointer create(const boost::asio::executor& executor) { + return pointer(new SyncTcpConnection(executor)); + }; +#else static pointer create(boost::asio::io_service& io_service) { return pointer(new SyncTcpConnection(io_service)); }; +#endif boost::function<void(SyncTcpConnection*)> onConnect; proto::socket& socket(); @@ -70,7 +76,11 @@ public: void start(); void Send(std::string message); private: +#if BOOST_VERSION >= 107000 + SyncTcpConnection(const boost::asio::executor& executor); +#else SyncTcpConnection(boost::asio::io_service& io_service); +#endif void handle_write(const boost::system::error_code & /*error*/, size_t /*bytes_transferred*/); |