]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/mon: let on_session_opened() return a future
authorKefu Chai <kchai@redhat.com>
Tue, 2 Mar 2021 08:31:00 +0000 (16:31 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 2 Mar 2021 11:04:28 +0000 (19:04 +0800)
so we can expand its responsibility to perform some async calls.

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

index 06c08dfdf12a1fd1a3f2f889473849037a6a8ac8..e5af77e52bd373867ef3b7e92f5f843034c581eb 100644 (file)
@@ -514,9 +514,10 @@ void Client::ms_handle_reset(crimson::net::ConnectionRef conn, bool /* is_replac
       active_con.reset();
       return reopen_session(-1).then([this] {
         if (active_con) {
-          on_session_opened();
+          return on_session_opened();
+        } else {
+          return seastar::now();
         }
-        return seastar::now();
       });
     } else {
       return seastar::now();
@@ -757,9 +758,10 @@ seastar::future<> Client::handle_monmap(crimson::net::ConnectionRef conn,
     logger().warn("mon.{} went away", cur_mon);
     return reopen_session(-1).then([this] {
       if (active_con) {
-        on_session_opened();
+        return on_session_opened();
+      } else {
+        return seastar::now();
       }
-      return seastar::now();
     });
   }
 }
@@ -878,9 +880,10 @@ seastar::future<> Client::authenticate()
 {
   return reopen_session(-1).then([this] {
     if (active_con) {
-      on_session_opened();
+      return on_session_opened();
+    } else {
+      return seastar::now();
     }
-    return seastar::now();
   });
 }
 
@@ -1019,13 +1022,14 @@ seastar::future<> Client::send_message(MessageRef m)
   }
 }
 
-void Client::on_session_opened()
+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();
 }
 
 bool Client::sub_want(const std::string& what, version_t start, unsigned flags)
index 549b407dc9c91a9984e6137454952434d731e2a0..430260c3170814e21a8cfbb21741958fd61f33f7 100644 (file)
@@ -155,7 +155,7 @@ private:
   seastar::future<> handle_log_ack(Ref<MLogAck> m);
   seastar::future<> handle_config(Ref<MConfig> m);
 
-  void on_session_opened();
+  seastar::future<> on_session_opened();
 private:
   seastar::future<> load_keyring();
   seastar::future<> authenticate();