Fix /get_random_outs with Boost 1.87+

This commit is contained in:
Lee Clagett
2025-06-04 20:07:27 -04:00
committed by Lee *!* Clagett
parent 4e85e3c828
commit 95848bd75f
3 changed files with 14 additions and 2 deletions

View File

@@ -26,7 +26,7 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.5.0)
project(monero-lws)
enable_language(CXX)
@@ -161,7 +161,7 @@ if(STATIC)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
endif()
find_package(Boost 1.70 QUIET REQUIRED COMPONENTS chrono coroutine filesystem program_options regex serialization system thread)
find_package(Boost 1.70 QUIET REQUIRED COMPONENTS chrono context coroutine filesystem program_options regex serialization system thread)
if (NOT (Boost_THREAD_LIBRARY STREQUAL monero_Boost_THREAD_LIBRARY_RELEASE))
message(STATUS "Found Boost_THREAD_LIBRARY: ${Boost_THREAD_LIBRARY}")

View File

@@ -56,6 +56,7 @@ target_link_libraries(monero-lws-daemon-common
monero-lws-wire-json
monero-lws-util
${Boost_CHRONO_LIBRARY}
${Boost_CONTEXT_LIBRARY}
${Boost_COROUTINE_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_SYSTEM_LIBRARY}

View File

@@ -993,7 +993,18 @@ namespace lws
lock.unlock();
MDEBUG("Starting new ZMQ coroutine in /get_random_outs");
#if BOOST_VERSION >= 108000
{
auto token = [] (const std::exception_ptr& e)
{
if (e)
std::rethrow_exception(e);
};
boost::asio::spawn(active->strand, async_handler{active}, std::move(token));
}
#else
boost::asio::spawn(active->strand, async_handler{active});
#endif
return success();
}
};