aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/crow/socket_adaptors.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/crow/socket_adaptors.h b/include/crow/socket_adaptors.h
index eda4b4c..1fdad5b 100644
--- a/include/crow/socket_adaptors.h
+++ b/include/crow/socket_adaptors.h
@@ -4,6 +4,13 @@
#include <boost/asio/ssl.hpp>
#endif
#include "crow/settings.h"
+
+#if BOOST_VERSION >= 107000
+# define SOCKET_CONTEXT(sock) (boost::asio::io_context&) sock.get_executor().context()
+#else
+# define SOCKET_CONTEXT(sock) sock.get_io_service()
+#endif
+
namespace crow
{
using namespace boost;
@@ -19,7 +26,7 @@ namespace crow
boost::asio::io_service& get_io_service()
{
- return (boost::asio::io_context&) socket_.get_executor().context();
+ return SOCKET_CONTEXT(socket_);
}
tcp::socket& raw_socket()