Skip to content

Commit

Permalink
Remove unnecessary ClientData init() method.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
clalancette committed Dec 17, 2024
1 parent 12df30d commit d50697f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
15 changes: 1 addition & 14 deletions rmw_zenoh_cpp/src/detail/rmw_client_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,6 @@ std::shared_ptr<ClientData> ClientData::make(
response_type_support
});

if (!client_data->init()) {
// init() already set the error.
return nullptr;
}

return client_data;
}

Expand All @@ -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);
Expand All @@ -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;
}

///=============================================================================
Expand Down
3 changes: 0 additions & 3 deletions rmw_zenoh_cpp/src/detail/rmw_client_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ class ClientData final : public std::enable_shared_from_this<ClientData>
std::shared_ptr<RequestTypeSupport> request_type_support,
std::shared_ptr<ResponseTypeSupport> response_type_support);

// Initialize the Zenoh objects for this entity.
bool init();

// Internal mutex.
mutable std::recursive_mutex mutex_;
// The parent node.
Expand Down

0 comments on commit d50697f

Please sign in to comment.