]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/mon/MonClient: refacor Client::handle_monmap
authorMatan Breizman <mbreizma@redhat.com>
Thu, 12 Jun 2025 09:22:22 +0000 (09:22 +0000)
committerPatrick Donnelly <pdonnell@ibm.com>
Mon, 22 Sep 2025 16:34:44 +0000 (12:34 -0400)
Use coroutines, should help with future changes.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
(cherry picked from commit cbadee607f9c53459b962df99e2c19b646313505)

src/crimson/mon/MonClient.cc

index 9e5bfb4641b909dcebab413e56c1cef3e487a9d1..ace25ee24e19d45a00b6703dfbe9a395fdc79012 100644 (file)
@@ -811,22 +811,18 @@ seastar::future<> Client::handle_monmap(crimson::net::Connection &conn,
                  monmap.epoch, cur_mon, monmap.get_rank(cur_mon));
   sub.got("monmap", monmap.get_epoch());
 
-  if (monmap.get_addr_name(peer_addr, cur_mon)) {
-    if (active_con) {
-      logger().info("handle_monmap: renewing tickets");
-      return _check_auth_tickets();
-    } else {
-      return seastar::now();
-    }
-  } else {
+  if (monmap.get_addr_name(peer_addr, cur_mon) == false) {
     logger().warn("mon.{} went away", cur_mon);
-    return reopen_session(-1).then([this](bool opened) {
-      if (opened) {
-        return on_session_opened();
-      } else {
-        return seastar::now();
-      }
-    });
+    bool opened = co_await reopen_session(-1);
+    if (opened) {
+      co_await on_session_opened();
+    }
+  }
+
+  // TODO: we can probably renew tickets only if the session was reopened
+  if (active_con) {
+    logger().info("handle_monmap: renewing tickets");
+    co_await _check_auth_tickets();
   }
 }