From b188bf5ed0dffc9b186714c0f8e9f10f282d6bd1 Mon Sep 17 00:00:00 2001 From: Khairy Moahmmed Date: Sat, 4 Jan 2020 13:37:54 +0200 Subject: [PATCH] fix get_io_service() for boost >= 1.7 get_io_service() is not a member of boost::asio::basic_stream_socket in the latest versions of boost . i found the solution here https://github.com/nghttp2/nghttp2/pull/1335/commits/cbba1ebf8fcecb24392f0cc07b1235b17d0de9d8 --- include/crow/socket_adaptors.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/crow/socket_adaptors.h b/include/crow/socket_adaptors.h index 901117f97..867415fe0 100644 --- a/include/crow/socket_adaptors.h +++ b/include/crow/socket_adaptors.h @@ -4,6 +4,14 @@ #include #endif #include "crow/settings.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 + namespace crow { using namespace boost; @@ -19,7 +27,7 @@ namespace crow boost::asio::io_service& get_io_service() { - return socket_.get_io_service(); + return GET_IO_SERVICE(socket_); } tcp::socket& raw_socket() @@ -96,7 +104,7 @@ namespace crow boost::asio::io_service& get_io_service() { - return raw_socket().get_io_service(); + return GET_IO_SERVICE(raw_socket()); } template