From b1bab68b71af49ac56e42f518da286c11736c800 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 13 Nov 2024 18:21:49 +0100 Subject: [PATCH] mon/MonClient: un-inline MonCommand ctor/dtor to reduce compile times Signed-off-by: Max Kellermann --- src/mon/MonClient.cc | 18 ++++++++++++++++++ src/mon/MonClient.h | 17 ++--------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 05e73f4753bd..b04646bd1589 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -1174,6 +1174,24 @@ int MonClient::wait_auth_rotating(double timeout) // --------- +MonClient::MonCommand::MonCommand(MonClient& monc, uint64_t t, CommandCompletion&& onfinish) + : tid(t), onfinish(std::move(onfinish)) { + auto timeout = + monc.cct->_conf.get_val("rados_mon_op_timeout"); + if (timeout.count() > 0) { + cancel_timer.emplace(monc.service, timeout); + cancel_timer->async_wait( + [this, &monc](boost::system::error_code ec) { + if (ec) + return; + std::scoped_lock l(monc.monc_lock); + monc._cancel_mon_command(tid); + }); + } +} + +MonClient::MonCommand::~MonCommand() = default; + void MonClient::_send_command(MonCommand *r) { if (r->is_tell()) { diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index b02e8b193385..70228404c5ca 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -581,21 +581,8 @@ private: CommandCompletion onfinish; std::optional cancel_timer; - MonCommand(MonClient& monc, uint64_t t, CommandCompletion&& onfinish) - : tid(t), onfinish(std::move(onfinish)) { - auto timeout = - monc.cct->_conf.get_val("rados_mon_op_timeout"); - if (timeout.count() > 0) { - cancel_timer.emplace(monc.service, timeout); - cancel_timer->async_wait( - [this, &monc](boost::system::error_code ec) { - if (ec) - return; - std::scoped_lock l(monc.monc_lock); - monc._cancel_mon_command(tid); - }); - } - } + MonCommand(MonClient& monc, uint64_t t, CommandCompletion&& onfinish); + ~MonCommand(); bool is_tell() const { return target_name.size() || target_rank >= 0; -- 2.47.3