From 66848beadf2eff6b80c98c1b5f081f261c3c5183 Mon Sep 17 00:00:00 2001 From: loonycyborg Date: Sat, 27 Feb 2021 19:40:51 +0300 Subject: [PATCH] Add conditional compilation for boost::asio::post() --- src/network_asio.cpp | 8 +++++++- src/wesnothd_connection.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/network_asio.cpp b/src/network_asio.cpp index 33981c1ebb44..56f67618e138 100644 --- a/src/network_asio.cpp +++ b/src/network_asio.cpp @@ -91,7 +91,13 @@ connection::connection(const std::string& host, const std::string& service) auto result = resolver_.resolve(CAMPAIGND_HOST_SPECIFICATION_NUMERIC, ec); if(!ec) { // if numeric resolve succeeds then we got raw ip address so TLS host name validation would never pass use_tls_ = false; - boost::asio::post(io_context_, [this, ec, result](){ handle_resolve(ec, { result } ); } ); +#if BOOST_VERSION >= 106600 + boost::asio::post(io_context_, +#else + io_context_.post( +#endif + [this, ec, result](){ handle_resolve(ec, { result } ); } + ); } else { resolver_.async_resolve(CAMPAIGND_HOST_SPECIFICATION, std::bind(&connection::handle_resolve, this, std::placeholders::_1, std::placeholders::_2)); diff --git a/src/wesnothd_connection.cpp b/src/wesnothd_connection.cpp index f8bf4585c9b8..d9f705aecded 100644 --- a/src/wesnothd_connection.cpp +++ b/src/wesnothd_connection.cpp @@ -92,7 +92,13 @@ wesnothd_connection::wesnothd_connection(const std::string& host, const std::str auto result = resolver_.resolve(WESNOTHD_HOST_SPECIFICATION_NUMERIC, ec); if(!ec) { // if numeric resolve succeeds then we got raw ip address so TLS host name validation would never pass use_tls_ = false; - boost::asio::post(io_context_, [this, ec, result](){ handle_resolve(ec, { result } ); } ); +#if BOOST_VERSION >= 106600 + boost::asio::post(io_context_, +#else + io_context_.post( +#endif + [this, ec, result](){ handle_resolve(ec, { result } ); } + ); } else { resolver_.async_resolve(WESNOTHD_HOST_SPECIFICATION, std::bind(&wesnothd_connection::handle_resolve, this, std::placeholders::_1, std::placeholders::_2));