From 555f1e85f9793f93461be8fa1155cccdb9415aee Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 9 May 2019 18:46:50 +0800 Subject: [PATCH] crimson/mon: run tick() periodically also send keepalive to monitor in tick() Signed-off-by: Kefu Chai --- src/crimson/mon/MonClient.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 { -- 2.47.3