From d50697fec9152c86d8ac9c3d42544cc8c85b68a4 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Tue, 17 Dec 2024 15:32:48 +0000 Subject: [PATCH] Remove unnecessary ClientData init() method. Since we aren't calling shared_from_this() in it anymore, we can do all of the work in the constructor. Signed-off-by: Chris Lalancette --- rmw_zenoh_cpp/src/detail/rmw_client_data.cpp | 15 +-------------- rmw_zenoh_cpp/src/detail/rmw_client_data.hpp | 3 --- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp index e1647180..170cf54c 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp @@ -142,11 +142,6 @@ std::shared_ptr ClientData::make( response_type_support }); - if (!client_data->init()) { - // init() already set the error. - return nullptr; - } - return client_data; } @@ -172,12 +167,6 @@ ClientData::ClientData( sequence_number_(1), is_shutdown_(false), initialized_(false) -{ - // Do nothing. -} - -///============================================================================= -bool ClientData::init() { std::string topic_keyexpr = this->entity_->topic_info().value().topic_keyexpr_; keyexpr_ = zenoh::KeyExpr(topic_keyexpr); @@ -191,12 +180,10 @@ bool ClientData::init() RMW_ZENOH_LOG_ERROR_NAMED( "rmw_zenoh_cpp", "Unable to create liveliness token for the client."); - return false; + throw std::runtime_error("Unable to create liveliness token for the client."); } initialized_ = true; - - return true; } ///============================================================================= diff --git a/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp index 6f753955..44b187ba 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp @@ -114,9 +114,6 @@ class ClientData final : public std::enable_shared_from_this std::shared_ptr request_type_support, std::shared_ptr response_type_support); - // Initialize the Zenoh objects for this entity. - bool init(); - // Internal mutex. mutable std::recursive_mutex mutex_; // The parent node.