From f6a25c50a398526b70e91f7f9ab4d7c4fe14c554 Mon Sep 17 00:00:00 2001 From: tilsche Date: Sun, 3 Dec 2023 23:43:13 +0100 Subject: [PATCH] fix: compilation with gcc/C++20 For some reason there is a weird template instantiation that breaks with the lambda auto parameter. --- src/connection_handler.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/connection_handler.cpp b/src/connection_handler.cpp index 7056b12..6cca10b 100644 --- a/src/connection_handler.cpp +++ b/src/connection_handler.cpp @@ -118,20 +118,21 @@ void AsioConnectionHandler::connect(const AMQP::Address& address) void AsioConnectionHandler::connect(asio::ip::tcp::resolver::iterator endpoint_iterator) { - asio::async_connect(this->underlying_socket(), endpoint_iterator, asio::ip::tcp::resolver::iterator(), - [this](const auto& error, auto successful_endpoint) { - if (error) - { - log::error("[{}] Failed to connect to: {}", name_, error.message()); - this->onError("Connect failed"); - return; - } - log::debug("[{}] Established connection to {} at {}", name_, - successful_endpoint->host_name(), - successful_endpoint->endpoint()); - - this->handshake(successful_endpoint->host_name()); - }); + asio::async_connect( + this->underlying_socket(), endpoint_iterator, asio::ip::tcp::resolver::iterator(), + [this](const std::error_code& error, + asio::ip::tcp::resolver::iterator successful_endpoint) { + if (error) + { + log::error("[{}] Failed to connect to: {}", name_, error.message()); + this->onError("Connect failed"); + return; + } + log::debug("[{}] Established connection to {} at {}", name_, + successful_endpoint->host_name(), successful_endpoint->endpoint()); + + this->handshake(successful_endpoint->host_name()); + }); } void PlainConnectionHandler::handshake(const std::string& hostname)