mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
monclient: add an initialized bool to guard shutdown.
The addition of a Finisher in 9c56070bc2
broke shutdown in the case where MonClient::init() was never called, so
add a guard variable to keep track.
I'm not sure this is actually the best solution (Timer guard itself,
for instance; maybe Finisher should too?), but I don't want to change
the Finisher interface without looking at it more carefully than I'm
going to right now.
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
This commit is contained in:
parent
3bb6ad9d20
commit
b5c27aec40
@ -51,6 +51,7 @@ MonClient::MonClient(CephContext *cct_) :
|
||||
cur_con(NULL),
|
||||
monc_lock("MonClient::monc_lock"),
|
||||
timer(cct_, monc_lock), finisher(cct_),
|
||||
initialized(false),
|
||||
log_client(NULL),
|
||||
hunting(true),
|
||||
want_monmap(true),
|
||||
@ -376,12 +377,16 @@ int MonClient::init()
|
||||
ldout(cct, 0) << "WARNING: unknown auth protocol defined: " << *iter << dendl;
|
||||
}
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MonClient::shutdown()
|
||||
{
|
||||
finisher.stop();
|
||||
if (initialized) {
|
||||
finisher.stop();
|
||||
}
|
||||
monc_lock.Lock();
|
||||
timer.shutdown();
|
||||
if (cur_con) {
|
||||
|
@ -64,6 +64,7 @@ private:
|
||||
Mutex monc_lock;
|
||||
SafeTimer timer;
|
||||
Finisher finisher;
|
||||
bool initialized;
|
||||
|
||||
LogClient *log_client;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user