Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use z_check and z_drop instead of zc_liveliness_XX #69

Merged
merged 6 commits into from
Nov 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions rmw_zenoh_cpp/src/rmw_zenoh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ rmw_create_node(
z_drop(z_move(node_data->token));
}
});
if (!zc_liveliness_token_check(&node_data->token)) {
if (!z_check(node_data->token)) {
RCUTILS_LOG_ERROR_NAMED(
"rmw_zenoh_cpp",
"Unable to create liveliness token for the node.");
Expand Down Expand Up @@ -250,7 +250,7 @@ rmw_destroy_node(rmw_node_t * node)
// Undeclare liveliness token for the node to advertise that the node has ridden
// off into the sunset.
rmw_node_data_t * node_data = static_cast<rmw_node_data_t *>(node->data);
zc_liveliness_undeclare_token(z_move(node_data->token));
z_drop((z_move(node_data->token));
JEnoch marked this conversation as resolved.
Show resolved Hide resolved

rcutils_allocator_t * allocator = &node->context->options.allocator;

Expand Down Expand Up @@ -581,10 +581,10 @@ rmw_create_publisher(
auto free_token = rcpputils::make_scope_exit(
[publisher_data]() {
if (publisher_data != nullptr) {
zc_liveliness_undeclare_token(z_move(publisher_data->token));
z_drop((z_move(publisher_data->token));
JEnoch marked this conversation as resolved.
Show resolved Hide resolved
}
});
if (!zc_liveliness_token_check(&publisher_data->token)) {
if (!z_check(publisher_data->token)) {
RCUTILS_LOG_ERROR_NAMED(
"rmw_zenoh_cpp",
"Unable to create liveliness token for the publisher.");
Expand Down Expand Up @@ -645,7 +645,7 @@ rmw_destroy_publisher(rmw_node_t * node, rmw_publisher_t * publisher)
// // TODO(Yadunund): Should this really return an error?
// return RMW_RET_ERROR;
// }
zc_liveliness_undeclare_token(z_move(publisher_data->token));
z_drop((z_move(publisher_data->token));
JEnoch marked this conversation as resolved.
Show resolved Hide resolved

RMW_TRY_DESTRUCTOR(publisher_data->type_support->~MessageTypeSupport(), MessageTypeSupport, );
allocator->deallocate(publisher_data->type_support, allocator->state);
Expand Down Expand Up @@ -1268,10 +1268,10 @@ rmw_create_subscription(
auto free_token = rcpputils::make_scope_exit(
[sub_data]() {
if (sub_data != nullptr) {
zc_liveliness_undeclare_token(z_move(sub_data->token));
z_drop((z_move(sub_data->token));
JEnoch marked this conversation as resolved.
Show resolved Hide resolved
}
});
if (!zc_liveliness_token_check(&sub_data->token)) {
if (!z_check(sub_data->token)) {
RCUTILS_LOG_ERROR_NAMED(
"rmw_zenoh_cpp",
"Unable to create liveliness token for the subscription.");
Expand Down Expand Up @@ -1315,7 +1315,7 @@ rmw_destroy_subscription(rmw_node_t * node, rmw_subscription_t * subscription)
auto sub_data = static_cast<rmw_subscription_data_t *>(subscription->data);
if (sub_data != nullptr) {
// Publish to the graph that a subscription has ridden off into the sunset
zc_liveliness_undeclare_token(z_move(sub_data->token));
z_drop((z_move(sub_data->token));
JEnoch marked this conversation as resolved.
Show resolved Hide resolved

RMW_TRY_DESTRUCTOR(sub_data->type_support->~MessageTypeSupport(), MessageTypeSupport, );
allocator->deallocate(sub_data->type_support, allocator->state);
Expand Down
Loading