If req->get_connection() returns a null pointer, drop the reply instead
of crashing the monitor.
Signed-off-by: Loic Dachary <loic@dachary.org>
void Monitor::send_reply(PaxosServiceMessage *req, Message *reply)
{
- MonSession *session = static_cast<MonSession*>(req->get_connection()->get_priv());
+ ConnectionRef connection = req->get_connection();
+ if (!connection) {
+ dout(2) << "send_reply no connection, dropping reply " << *reply
+ << " to " << req << " " << *req << dendl;
+ reply->put();
+ return;
+ }
+ MonSession *session = static_cast<MonSession*>(connection->get_priv());
if (!session) {
dout(2) << "send_reply no session, dropping reply " << *reply
<< " to " << req << " " << *req << dendl;