crimson/mon: pending_messages should not be empty if active_conn

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>
This commit is contained in:
Kefu Chai 2021-03-02 16:18:20 +08:00
parent 83d2e322a3
commit aea159c626

View 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()