Fix build with boost ASIO 1.87. Support boost 1.66+

This commit is contained in:
Lee *!* Clagett 2024-12-17 16:40:15 -05:00
parent 2e8a128c75
commit 4344f97255
37 changed files with 397 additions and 375 deletions

View file

@ -30,7 +30,7 @@
#define _NET_UTILS_BASE_H_
#include <boost/uuid/uuid.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/address_v6.hpp>
#include <typeinfo>
#include <type_traits>
@ -47,10 +47,12 @@
#define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(((uint32_t)a4)<<24))
#endif
/* Use the below function carefully. The executor and io_context are slightly
different concepts. */
#if BOOST_VERSION >= 107000
#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
#define MONERO_GET_EXECUTOR(type) type . get_executor()
#else
#define GET_IO_SERVICE(s) ((s).get_io_service())
#define MONERO_GET_EXECUTOR(type) type . get_io_context()
#endif
namespace net
@ -443,7 +445,7 @@ namespace net_utils
virtual bool send_done()=0;
virtual bool call_run_once_service_io()=0;
virtual bool request_callback()=0;
virtual boost::asio::io_service& get_io_service()=0;
virtual boost::asio::io_context& get_io_context()=0;
//protect from deletion connection object(with protocol instance) during external call "invoke"
virtual bool add_ref()=0;
virtual bool release()=0;