From e305a5908bd7bd3f2fa906af8521aea989f0c0ca Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Sat, 7 Dec 2024 12:37:29 +0100 Subject: [PATCH] librbd/migration/HttpClient: propagate ec to handle_handshake() Get rid of get_callback_adapter() which only obfuscates the error: handle_handshake: failed to complete SSL handshake: (337047686) Unknown error 337047686 vs handle_handshake: failed to complete SSL handshake: certificate verify failed (SSL routines, tls_process_server_certificate) Signed-off-by: Ilya Dryomov --- src/librbd/migration/HttpClient.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/librbd/migration/HttpClient.cc b/src/librbd/migration/HttpClient.cc index b341bee709c..769187586e4 100644 --- a/src/librbd/migration/HttpClient.cc +++ b/src/librbd/migration/HttpClient.cc @@ -739,19 +739,20 @@ private: // Perform the SSL/TLS handshake m_stream.async_handshake( boost::asio::ssl::stream_base::client, - asio::util::get_callback_adapter( - [this, on_finish](int r) { handle_handshake(r, on_finish); })); + [this, on_finish](boost::system::error_code ec) { + handle_handshake(ec, on_finish); + }); } - void handle_handshake(int r, Context* on_finish) { + void handle_handshake(boost::system::error_code ec, Context* on_finish) { auto http_client = this->m_http_client; auto cct = http_client->m_cct; - ldout(cct, 15) << "r=" << r << dendl; + ldout(cct, 15) << "ec=" << ec.what() << dendl; - if (r < 0) { - lderr(cct) << "failed to complete handshake: " << cpp_strerror(r) + if (ec) { + lderr(cct) << "failed to complete SSL handshake: " << ec.message() << dendl; - on_finish->complete(r); + on_finish->complete(-ec.value()); return; } -- 2.39.5