From b5c27aec40fb39dff033a98c7cf2f59560285468 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Wed, 5 Oct 2011 09:50:51 -0700 Subject: [PATCH] monclient: add an initialized bool to guard shutdown. The addition of a Finisher in 9c56070bc20878e87fcb4715b0a3559dd1aaf9ff 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 --- src/mon/MonClient.cc | 7 ++++++- src/mon/MonClient.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 138453b3ef3..112ea63558f 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -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) { diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index f437317a74d..207b30abbb6 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -64,6 +64,7 @@ private: Mutex monc_lock; SafeTimer timer; Finisher finisher; + bool initialized; LogClient *log_client;