From 33494b27f74311de30673f7c010963f9039f8f41 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 16 May 2017 16:41:26 +0800 Subject: [PATCH] mon/MgrMonitor: s/digest_callback/digest_event/ to be consistent with the rest of mon Signed-off-by: Kefu Chai --- src/mon/MgrMonitor.cc | 15 +++++++-------- src/mon/MgrMonitor.h | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mon/MgrMonitor.cc b/src/mon/MgrMonitor.cc index b36da2fce57..1e5f9558689 100644 --- a/src/mon/MgrMonitor.cc +++ b/src/mon/MgrMonitor.cc @@ -263,7 +263,7 @@ void MgrMonitor::check_sub(Subscription *sub) } } else { assert(sub->type == "mgrdigest"); - if (digest_callback == nullptr) { + if (digest_event == nullptr) { send_digests(); } } @@ -275,7 +275,7 @@ void MgrMonitor::check_sub(Subscription *sub) */ void MgrMonitor::send_digests() { - digest_callback = nullptr; + digest_event = nullptr; const std::string type = "mgrdigest"; if (mon->session_map.subs.count(type) == 0) @@ -298,10 +298,10 @@ void MgrMonitor::send_digests() sub->session->con->send_message(mdigest); } - digest_callback = new C_MonContext(mon, [this](int){ + digest_event = new C_MonContext(mon, [this](int){ send_digests(); }); - mon->timer.add_event_after(g_conf->mon_mgr_digest_period, digest_callback); + mon->timer.add_event_after(g_conf->mon_mgr_digest_period, digest_event); } void MgrMonitor::on_active() @@ -538,15 +538,14 @@ bool MgrMonitor::prepare_command(MonOpRequestRef op) void MgrMonitor::init() { - if (digest_callback == nullptr) { + if (digest_event == nullptr) { send_digests(); // To get it to schedule its own event } } void MgrMonitor::on_shutdown() { - if (digest_callback) { - mon->timer.cancel_event(digest_callback); + if (digest_event) { + mon->timer.cancel_event(digest_event); } } - diff --git a/src/mon/MgrMonitor.h b/src/mon/MgrMonitor.h index a582d95b1f6..f4e6f9920d7 100644 --- a/src/mon/MgrMonitor.h +++ b/src/mon/MgrMonitor.h @@ -36,13 +36,13 @@ class MgrMonitor : public PaxosService void drop_active(); void drop_standby(uint64_t gid); - Context *digest_callback; + Context *digest_event = nullptr; bool check_caps(MonOpRequestRef op, const uuid_d& fsid); public: MgrMonitor(Monitor *mn, Paxos *p, const string& service_name) - : PaxosService(mn, p, service_name), digest_callback(nullptr) + : PaxosService(mn, p, service_name) {} void init() override;