From: Loic Dachary Date: Wed, 12 Feb 2014 15:48:04 +0000 (+0100) Subject: mon: Monitor::send_reply gracefully handles no connection X-Git-Tag: v0.78~186^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5ea156a09a8a575e7b6c247dc5fbfec0121b60d9;p=ceph.git mon: Monitor::send_reply gracefully handles no connection If req->get_connection() returns a null pointer, drop the reply instead of crashing the monitor. Signed-off-by: Loic Dachary --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 35d880c4559c..a59dcbe21165 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2526,7 +2526,14 @@ void Monitor::try_send_message(Message *m, const entity_inst_t& to) void Monitor::send_reply(PaxosServiceMessage *req, Message *reply) { - MonSession *session = static_cast(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(connection->get_priv()); if (!session) { dout(2) << "send_reply no session, dropping reply " << *reply << " to " << req << " " << *req << dendl;