mirror of
https://github.com/ceph/ceph
synced 2025-01-10 13:10:46 +00:00
mon: fix leak of loopback Connection
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>
This commit is contained in:
parent
08bb8d510b
commit
a99435d06d
@ -119,6 +119,7 @@ Monitor::Monitor(CephContext* cct_, string nm, MonitorDBStore *s,
|
||||
name(nm),
|
||||
rank(-1),
|
||||
messenger(m),
|
||||
con_self(m ? m->get_loopback_connection() : NULL),
|
||||
lock("Monitor::lock"),
|
||||
timer(cct_, lock),
|
||||
has_ever_joined(false),
|
||||
@ -208,6 +209,8 @@ Monitor::~Monitor()
|
||||
delete paxos;
|
||||
assert(session_map.sessions.empty());
|
||||
delete mon_caps;
|
||||
if (con_self)
|
||||
con_self->put();
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,6 +108,7 @@ public:
|
||||
string name;
|
||||
int rank;
|
||||
Messenger *messenger;
|
||||
Connection *con_self;
|
||||
Mutex lock;
|
||||
SafeTimer timer;
|
||||
|
||||
|
@ -48,7 +48,7 @@ bool PaxosService::dispatch(PaxosServiceMessage *m)
|
||||
// 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;
|
||||
|
Loading…
Reference in New Issue
Block a user