]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/mon: run tick() periodically 28041/head
authorKefu Chai <kchai@redhat.com>
Thu, 9 May 2019 10:46:50 +0000 (18:46 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 9 May 2019 11:14:00 +0000 (19:14 +0800)
also send keepalive to monitor in tick()

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/mon/MonClient.cc

index 1bdb3f734802426b26de24756b89224a0deca5ca..683bcea294e8b9be1b47099b5ef25325852b2c1d 100644 (file)
@@ -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<seastar::lowres_clock::duration>(
+        std::chrono::duration<double>(
+          local_conf().get_val<double>("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 {