From aec95153b6536749ee5aebb659f99ada8aadf8be Mon Sep 17 00:00:00 2001 From: Harihara Kadayam Date: Wed, 6 Mar 2024 09:14:14 -0800 Subject: [PATCH] Addressed review comments --- src/lib/manager_impl.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/manager_impl.cpp b/src/lib/manager_impl.cpp index 510dbb0..bebab2a 100644 --- a/src/lib/manager_impl.cpp +++ b/src/lib/manager_impl.cpp @@ -190,7 +190,7 @@ nuraft::cmd_result_code ManagerImpl::group_init(int32_t const srv_id, group_id_t smgr = it->second; smgr->become_ready(); sm = smgr->get_state_machine(); - smgr->set_manager_impl(std::weak_ptr< ManagerImpl >(shared_from_this())); + smgr->set_manager_impl(shared_from_this()); } else { return nuraft::cmd_result_code::CANCELLED; } @@ -204,7 +204,7 @@ nuraft::cmd_result_code ManagerImpl::group_init(int32_t const srv_id, group_id_t std::shared_ptr< nuraft::rpc_listener > listener; nuraft::ptr< nuraft::logger > logger = std::make_shared< nuraft_mesg_logger >(group_id, _custom_logger); - auto base_smgr = std::dynamic_pointer_cast< nuraft::state_mgr >(smgr); + auto base_smgr = std::static_pointer_cast< nuraft::state_mgr >(smgr); ctx = new nuraft::context(base_smgr, sm, listener, logger, rpc_cli_factory, _scheduler, params); ctx->set_cb_func([wp = std::weak_ptr< mesg_state_mgr >(smgr), group_id](nuraft::cb_func::Type type, nuraft::cb_func::Param* param) { @@ -365,9 +365,7 @@ void mesg_state_mgr::make_repl_ctx(grpc_server* server, std::shared_ptr< mesg_fa nuraft::cb_func::ReturnCode mesg_state_mgr::internal_raft_event_handler(group_id_t const& group_id, nuraft::cb_func::Type type, nuraft::cb_func::Param* param) { - auto const [handled, ret] = handle_raft_event(type, param); - if (handled) { return ret; } - + if (auto const [handled, ret] = handle_raft_event(type, param); handled) { return ret; } return m_manager.lock()->generic_raft_event_handler(group_id, type, param); }