Skip to content

Commit

Permalink
Add conditional compilation for boost::asio::post()
Browse files Browse the repository at this point in the history
  • Loading branch information
loonycyborg committed Feb 27, 2021
1 parent 4bed74a commit 66848be
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/network_asio.cpp
Expand Up @@ -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));
Expand Down
8 changes: 7 additions & 1 deletion src/wesnothd_connection.cpp
Expand Up @@ -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));
Expand Down

0 comments on commit 66848be

Please sign in to comment.