From: Matan Breizman Date: Thu, 12 Jun 2025 09:22:22 +0000 (+0000) Subject: crimson/mon/MonClient: refacor Client::handle_monmap X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=41241cb14561e39338ff1286df551257de88f673;p=ceph-ci.git crimson/mon/MonClient: refacor Client::handle_monmap Use coroutines, should help with future changes. Signed-off-by: Matan Breizman Signed-off-by: Patrick Donnelly (cherry picked from commit cbadee607f9c53459b962df99e2c19b646313505) --- diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index 9e5bfb4641b..ace25ee24e1 100644 --- a/src/crimson/mon/MonClient.cc +++ b/src/crimson/mon/MonClient.cc @@ -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(); } }