1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix build with Boost versioni >= 1.70 (#615)

This commit is contained in:
krkos 2020-01-21 09:55:28 +01:00 committed by Alexander Shishkin
parent 8bfe510e9c
commit ac81d0f7b4
2 changed files with 13 additions and 2 deletions

View File

@ -14,6 +14,11 @@
struct CPack;
#if BOOST_VERSION >= 107000 // Boost version >= 1.70
#include <boost/asio.hpp>
typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp > TSocket;
typedef boost::asio::basic_socket_acceptor < boost::asio::ip::tcp > TAcceptor;
#else
namespace boost
{
namespace asio
@ -43,6 +48,8 @@ namespace boost
typedef boost::asio::basic_stream_socket < boost::asio::ip::tcp , boost::asio::stream_socket_service<boost::asio::ip::tcp> > TSocket;
typedef boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> > TAcceptor;
#endif
/// Main class for network communication
/// Allows establishing connection and bidirectional read-write

View File

@ -214,8 +214,8 @@ void CVCMIServer::threadAnnounceLobby()
if(acceptor)
{
acceptor->get_io_service().reset();
acceptor->get_io_service().poll();
io->reset();
io->poll();
}
}
@ -272,7 +272,11 @@ void CVCMIServer::startAsyncAccept()
assert(!upcomingConnection);
assert(acceptor);
#if BOOST_VERSION >= 107000 // Boost version >= 1.70
upcomingConnection = std::make_shared<TSocket>(acceptor->get_executor());
#else
upcomingConnection = std::make_shared<TSocket>(acceptor->get_io_service());
#endif
acceptor->async_accept(*upcomingConnection, std::bind(&CVCMIServer::connectionAccepted, this, _1));
}