]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/migration/HttpClient: propagate ec to handle_handshake()
authorIlya Dryomov <idryomov@gmail.com>
Sat, 7 Dec 2024 11:37:29 +0000 (12:37 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 16 Dec 2024 08:51:26 +0000 (09:51 +0100)
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 <idryomov@gmail.com>
(cherry picked from commit e305a5908bd7bd3f2fa906af8521aea989f0c0ca)

src/librbd/migration/HttpClient.cc

index b341bee709c3a9c55e58f19987afa05731121b36..769187586e4347ebb9c954efdee29a7622ad3dfa 100644 (file)
@@ -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;
     }