From 74001778ef978b669b4f7f6e1ed4bf3aaef0a9b6 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 10 Mar 2020 18:37:58 +0800 Subject: [PATCH] crimson/mgr: s/tick/report/ prepare for the change to reconnect right when handling connection reset Signed-off-by: Kefu Chai --- src/crimson/mgr/client.cc | 18 +++++++++--------- src/crimson/mgr/client.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/crimson/mgr/client.cc b/src/crimson/mgr/client.cc index 60fbfdf683629..3b33c176b6a3d 100644 --- a/src/crimson/mgr/client.cc +++ b/src/crimson/mgr/client.cc @@ -26,7 +26,7 @@ Client::Client(crimson::net::Messenger& msgr, WithStats& with_stats) : msgr{msgr}, with_stats{with_stats}, - tick_timer{[this] {tick();}} + report_timer{[this] {report();}} {} seastar::future<> Client::start() @@ -62,7 +62,7 @@ seastar::future<> Client::ms_handle_reset(crimson::net::ConnectionRef c) { if (conn == c) { conn = nullptr; - tick_timer.cancel(); + report_timer.cancel(); } return seastar::now(); } @@ -104,20 +104,20 @@ seastar::future<> Client::handle_mgr_conf(crimson::net::Connection* conn, { logger().info("{} {}", __func__, *m); - auto tick_period = std::chrono::seconds{m->stats_period}; - if (tick_period.count()) { - if (tick_timer.armed()) { - tick_timer.rearm(tick_timer.get_timeout(), tick_period); + auto report_period = std::chrono::seconds{m->stats_period}; + if (report_period.count()) { + if (report_timer.armed()) { + report_timer.rearm(report_timer.get_timeout(), report_period); } else { - tick_timer.arm_periodic(tick_period); + report_timer.arm_periodic(report_period); } } else { - tick_timer.cancel(); + report_timer.cancel(); } return seastar::now(); } -void Client::tick() +void Client::report() { (void) seastar::with_gate(gate, [this] { if (conn) { diff --git a/src/crimson/mgr/client.h b/src/crimson/mgr/client.h index 0332c59d57b42..0a7048eed3ed3 100644 --- a/src/crimson/mgr/client.h +++ b/src/crimson/mgr/client.h @@ -45,14 +45,14 @@ private: seastar::future<> handle_mgr_conf(crimson::net::Connection* conn, Ref m); seastar::future<> reconnect(); - void tick(); + void report(); private: MgrMap mgrmap; crimson::net::Messenger& msgr; WithStats& with_stats; crimson::net::ConnectionRef conn; - seastar::timer tick_timer; + seastar::timer report_timer; seastar::gate gate; }; -- 2.39.5