Core/Network: Build fix for older boost versions

This commit is contained in:
Shauren
2025-11-02 14:28:50 +01:00
parent d1a4551bc6
commit 0275ba9177
2 changed files with 14 additions and 3 deletions

View File

@@ -23,6 +23,7 @@
#include <boost/asio/detail/handler_cont_helpers.hpp>
#include <boost/outcome/result.hpp>
#include <boost/preprocessor/empty.hpp>
#include <boost/preprocessor/comma.hpp>
#include <type_traits>
namespace Trinity::Asio
@@ -194,6 +195,8 @@ STAMP_AS_EXPECTED_SIGNATURE(noexcept);
STAMP_AS_EXPECTED_SIGNATURE(& noexcept);
STAMP_AS_EXPECTED_SIGNATURE(&& noexcept);
#undef STAMP_AS_EXPECTED_SIGNATURE
} // namespace Impl
}
@@ -239,11 +242,17 @@ public:
}
};
template <template <typename, typename> class Associator, typename Handler, typename DefaultCandidate, typename _>
#if BOOST_VERSION >= 108600
#define TRINITY_BOOST_ASIO_ASSOCIATOR_SFINAE_PARAM(param) param
#else
#define TRINITY_BOOST_ASIO_ASSOCIATOR_SFINAE_PARAM(param)
#endif
template <template <typename, typename> class Associator, typename Handler, typename DefaultCandidate TRINITY_BOOST_ASIO_ASSOCIATOR_SFINAE_PARAM(BOOST_PP_COMMA() typename _)>
struct associator;
template <template <typename, typename> class Associator, typename Handler, typename DefaultCandidate>
struct associator<Associator, Trinity::Asio::Impl::AsExpectedHandler<Handler>, DefaultCandidate, void> : Associator<Handler, DefaultCandidate>
struct associator<Associator, Trinity::Asio::Impl::AsExpectedHandler<Handler>, DefaultCandidate TRINITY_BOOST_ASIO_ASSOCIATOR_SFINAE_PARAM(BOOST_PP_COMMA() void)> : Associator<Handler, DefaultCandidate>
{
static inline auto get(Trinity::Asio::Impl::AsExpectedHandler<Handler> const& h) noexcept
{
@@ -256,6 +265,8 @@ struct associator<Associator, Trinity::Asio::Impl::AsExpectedHandler<Handler>, D
}
};
#undef TRINITY_BOOST_ASIO_ASSOCIATOR_SFINAE_PARAM
template <typename... Signatures>
class async_result<Trinity::Asio::AsExpectedFn, Signatures...>
{

View File

@@ -459,7 +459,7 @@ struct Connect
else
{
#if BOOST_VERSION >= 107700
if (handler.cancelled() != boost::asio::cancellation_type::none)
if (handler.get_cancellation_state().cancelled() != boost::asio::cancellation_type::none)
{
Connect::HandleError(socket.get(), "connect cancelled");
error = boost::asio::error::operation_aborted;