From: Kefu Chai Date: Thu, 9 May 2019 10:46:50 +0000 (+0800) Subject: crimson/mon: run tick() periodically X-Git-Tag: v15.1.0~2706^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F28041%2Fhead;p=ceph.git crimson/mon: run tick() periodically also send keepalive to monitor in tick() Signed-off-by: Kefu Chai --- diff --git a/src/crimson/mon/MonClient.cc b/src/crimson/mon/MonClient.cc index 1bdb3f734802..683bcea294e8 100644 --- a/src/crimson/mon/MonClient.cc +++ b/src/crimson/mon/MonClient.cc @@ -439,6 +439,12 @@ seastar::future<> Client::start() { return monmap.build_initial(ceph::common::local_conf(), false); }).then([this] { return authenticate(); + }).then([this] { + auto interval = + std::chrono::duration_cast( + std::chrono::duration( + local_conf().get_val("mon_client_ping_interval"))); + timer.arm_periodic(interval); }); } @@ -460,8 +466,13 @@ seastar::future<> Client::load_keyring() void Client::tick() { seastar::with_gate(tick_gate, [this] { - return seastar::when_all_succeed(active_con->renew_tickets(), - active_con->renew_rotating_keyring()); + if (active_con) { + return seastar::when_all_succeed(active_con->get_conn()->keepalive(), + active_con->renew_tickets(), + active_con->renew_rotating_keyring()); + } else { + return seastar::now(); + } }); } @@ -862,6 +873,7 @@ seastar::future<> Client::authenticate() seastar::future<> Client::stop() { return tick_gate.close().then([this] { + timer.cancel(); if (active_con) { return active_con->close(); } else {