From 886ac8b7a060e4806abac5b92feccff7bcce27eb Mon Sep 17 00:00:00 2001 From: Richard Hodges Date: Wed, 26 Aug 2020 13:35:01 +0200 Subject: [PATCH] Add handler tracking locations to detect_ssl --- CHANGELOG.md | 1 + include/boost/beast/core/detect_ssl.hpp | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f28ea9b..0c113857 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ Version XXX: +* Add handler tracking locations to detect_ssl. * Add handler tracking locations to icy_stream. * Add handler tracking locations to basic_stream. * Add handler tracking locations to http operations. diff --git a/include/boost/beast/core/detect_ssl.hpp b/include/boost/beast/core/detect_ssl.hpp index 644318de..272535f5 100644 --- a/include/boost/beast/core/detect_ssl.hpp +++ b/include/boost/beast/core/detect_ssl.hpp @@ -591,8 +591,19 @@ operator()(error_code ec, std::size_t bytes_transferred, bool cont) // by the move, are first moved to the stack before calling the // initiating function. - yield stream_.async_read_some(buffer_.prepare( - read_size(buffer_, 1536)), std::move(*this)); + yield + { + // This macro facilitates asynchrnous handler tracking and + // debugging when the preprocessor macro + // BOOST_ASIO_CUSTOM_HANDLER_TRACKING is defined. + + BOOST_ASIO_HANDLER_LOCATION(( + __FILE__, __LINE__, + "async_detect_ssl")); + + stream_.async_read_some(buffer_.prepare( + read_size(buffer_, 1536)), std::move(*this)); + } // Commit what we read into the buffer's input area. buffer_.commit(bytes_transferred); @@ -626,7 +637,14 @@ operator()(error_code ec, std::size_t bytes_transferred, bool cont) // used in the call to async_read_some above, to avoid // instantiating another version of the function template. - yield stream_.async_read_some(buffer_.prepare(0), std::move(*this)); + yield + { + BOOST_ASIO_HANDLER_LOCATION(( + __FILE__, __LINE__, + "async_detect_ssl")); + + stream_.async_read_some(buffer_.prepare(0), std::move(*this)); + } // Restore the saved error code ec = ec_;