]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/mon: move keyring and sub renewals into on_session_opened()
authorKefu Chai <kchai@redhat.com>
Tue, 2 Mar 2021 08:38:04 +0000 (16:38 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 2 Mar 2021 11:04:28 +0000 (19:04 +0800)
both of them fall into the category of jobs which we should do after
the connection to monitor is established.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/mon/MonClient.cc

index e5af77e52bd373867ef3b7e92f5f843034c581eb..e72f45bb0e7154578edd4cb14de837ea432e40af 100644 (file)
@@ -957,11 +957,7 @@ seastar::future<> Client::reopen_session(int rank)
   }).then([this] {
     if (!active_con) {
       logger().warn("cannot establish the active_con with any mon");
-      return seastar::now();
     }
-    return active_con->renew_rotating_keyring();
-  }).then([this] {
-    return sub.reload() ? renew_subs() : seastar::now();
   });
 }
 
@@ -1024,12 +1020,16 @@ seastar::future<> Client::send_message(MessageRef m)
 
 seastar::future<> Client::on_session_opened()
 {
-  for (auto& m : pending_messages) {
-    (void) active_con->get_conn()->send(m.msg);
-    m.pr.set_value();
-  }
-  pending_messages.clear();
-  return seastar::now();
+  return active_con->renew_rotating_keyring().then([this] {
+    return sub.reload() ? renew_subs() : seastar::now();
+  }).then([this] {
+    for (auto& m : pending_messages) {
+      (void) active_con->get_conn()->send(m.msg);
+      m.pr.set_value();
+    }
+    pending_messages.clear();
+    return seastar::now();
+  });
 }
 
 bool Client::sub_want(const std::string& what, version_t start, unsigned flags)