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