The accessor returns a reference. Instead of taking+dropping it each
time, take one ref in Monitor ctor and release it in the dtor.
Signed-off-by: Sage Weil <sage@inktank.com>
name(nm),
rank(-1),
messenger(m),
+ con_self(m ? m->get_loopback_connection() : NULL),
lock("Monitor::lock"),
timer(cct_, lock),
has_ever_joined(false),
delete paxos;
assert(session_map.sessions.empty());
delete mon_caps;
+ if (con_self)
+ con_self->put();
}
string name;
int rank;
Messenger *messenger;
+ Connection *con_self;
Mutex lock;
SafeTimer timer;
// connection will be disconnected with a null message; don't drop
// those. also ignore loopback (e.g., log) messages.
if (!m->get_connection()->is_connected() &&
- m->get_connection() != mon->messenger->get_loopback_connection() &&
+ m->get_connection() != mon->con_self &&
m->get_connection()->get_messenger() != NULL) {
dout(10) << " discarding message from disconnected client "
<< m->get_source_inst() << " " << *m << dendl;