as per Yingxin Cheng,
> The send process can be asynchronous (there is a conn.out_q, or if the
> underlying socket lives in a different core in the m:n model to be
> ordered there). If user really wants to reuse a message, they must be
> careful not to modify it because it may result in modifing the pending
> messages.
>
> I think the best way is to copy the message if user want to resend it,
> and keep the ceph_assert(!msg->get_seq()). It may looks good to reuse a
> message under lossy policy, but the correctness is now up to user not to
> modify it inplace.
see also https://github.com/ceph/ceph/pull/39786
Signed-off-by: Kefu Chai <kchai@redhat.com>
m->set_tid(tid);
m->cmd = {std::move(cmd)};
m->set_data(std::move(bl));
- mon_commands.emplace_back(m);
- auto& command = mon_commands.back();
- return send_message(command.req).then([&result=command.result] {
+ auto& command = mon_commands.emplace_back(make_message<MMonCommand>(*m));
+ return send_message(std::move(m)).then([&result=command.result] {
return result.get_future();
});
}
}).then([this] {
return seastar::parallel_for_each(mon_commands,
[this](auto &command) {
- return send_message(command.req);
+ return send_message(make_message<MMonCommand>(*command.req));
});
});
}