From 73cc971eb5fad89093e7dddba5e0177954fcb81b Mon Sep 17 00:00:00 2001 From: Jarle Aase Date: Tue, 27 Aug 2024 17:07:33 +0300 Subject: [PATCH] Fixed regression with boost 1.86 --- CMakeLists.txt | 2 +- src/mysqlpool.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c84cffa..2f78bd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) if (NOT DEFINED MYSQLPOOL_VERSION) - set(MYSQLPOOL_VERSION 0.4.0) + set(MYSQLPOOL_VERSION 0.4.1) endif() project(mysqlpool-cpp diff --git a/src/mysqlpool.cpp b/src/mysqlpool.cpp index 6691063..69c5979 100644 --- a/src/mysqlpool.cpp +++ b/src/mysqlpool.cpp @@ -80,10 +80,14 @@ asio::awaitable Mysqlpool::getConnection(const Options& opts) MYSQLPOOL_LOG_TRACE_("Waiting for a DB connection to become available..."); - const auto [ec] = co_await semaphore_.async_wait(as_tuple(asio::use_awaitable)); - if (ec != boost::asio::error::operation_aborted) { - MYSQLPOOL_LOG_DEBUG_("async_wait on semaphore failed: " << ec.message()); + try { + co_await semaphore_.async_wait(as_tuple(asio::use_awaitable)); + } catch(const boost::system::system_error& ec) { + if (ec.code() != boost::asio::error::operation_aborted) { + MYSQLPOOL_LOG_DEBUG_("async_wait on semaphore failed: " << ec.what()); + } } + MYSQLPOOL_LOG_TRACE_("Done waiting"); }