]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/mon: pending_messages should not be empty if active_conn
authorKefu Chai <kchai@redhat.com>
Tue, 2 Mar 2021 08:18:20 +0000 (16:18 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 2 Mar 2021 11:04:28 +0000 (19:04 +0800)
we always send all pending_messages, and clear it when establishing a
connection to mon, so there is no need to check for it when calling
`send_message()`.

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

index 3baf5f9fbf1588f9b578414c54a49dae6ac742f6..f623ac2cac94ece16f561c5daf83647b05a110d8 100644 (file)
@@ -1011,13 +1011,12 @@ Client::run_command(const std::vector<std::string>& cmd,
 seastar::future<> Client::send_message(MessageRef m)
 {
   if (active_con) {
-    if (!pending_messages.empty()) {
-      send_pendings();
-    }
+    assert(pending_messages.empty());
     return active_con->get_conn()->send(m);
+  } else {
+    auto& delayed = pending_messages.emplace_back(m);
+    return delayed.pr.get_future();
   }
-  auto& delayed = pending_messages.emplace_back(m);
-  return delayed.pr.get_future();
 }
 
 void Client::send_pendings()