From: Colin Patrick McCabe Date: Thu, 4 Nov 2010 05:00:31 +0000 (-0700) Subject: MonClient: start SafeTimer in MonClient::init() X-Git-Tag: v0.24~229^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c4e56e9a5ea9cf0964169e2ec41102325fb63350;p=ceph.git MonClient: start SafeTimer in MonClient::init() Signed-off-by: Colin McCabe --- diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index ca4d068511aa..d320b3b55cb9 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -279,6 +279,7 @@ void MonClient::handle_monmap(MMonMap *m) void MonClient::init() { dout(10) << "init" << dendl; + timer.reset(new SafeTimer(monc_lock)); messenger->add_dispatcher_head(this); entity_name = *g_conf.entity_name; @@ -308,7 +309,7 @@ void MonClient::init() void MonClient::shutdown() { - timer.cancel_all_events(); + timer->cancel_all_events(); } int MonClient::authenticate(double timeout) @@ -514,9 +515,9 @@ void MonClient::tick() void MonClient::schedule_tick() { if (hunting) - timer.add_event_after(g_conf.mon_client_hunt_interval, new C_Tick(this)); + timer->add_event_after(g_conf.mon_client_hunt_interval, new C_Tick(this)); else - timer.add_event_after(g_conf.mon_client_ping_interval, new C_Tick(this)); + timer->add_event_after(g_conf.mon_client_ping_interval, new C_Tick(this)); } diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index cbed179f594b..ffdde1e5ff41 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -27,6 +27,8 @@ #include "messages/MMonSubscribe.h" +#include + class MonMap; class MMonMap; class MMonSubscribeAck; @@ -56,7 +58,7 @@ private: entity_addr_t my_addr; Mutex monc_lock; - SafeTimer timer; + std::auto_ptr < SafeTimer > timer; set<__u32> auth_supported; @@ -163,7 +165,6 @@ public: state(MC_STATE_NONE), messenger(NULL), monc_lock("MonClient::monc_lock"), - timer(monc_lock), hunting(true), want_monmap(true), want_keys(0), global_id(0), @@ -172,7 +173,6 @@ public: rotating_secrets(rkeys) { } ~MonClient() { - timer.shutdown(); } void init();