Skip to content

Commit

Permalink
refactor: remove the free_attachment
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanYuYuan committed Oct 24, 2024
1 parent ab5e0be commit 24f479b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
5 changes: 0 additions & 5 deletions rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,8 @@ rmw_ret_t PublisherData::publish(
z_owned_bytes_t attachment;
uint8_t local_gid[RMW_GID_STORAGE_SIZE];
entity_->copy_gid(local_gid);
auto always_free_attachment = rcpputils::make_scope_exit(
[&attachment]() {
z_drop(z_move(attachment));
});
create_map_and_set_sequence_num(&attachment, sequence_number_++, local_gid);
options.attachment = z_move(attachment);
always_free_attachment.cancel();

z_owned_bytes_t payload;
if (shmbuf.has_value()) {
Expand Down
6 changes: 1 addition & 5 deletions rmw_zenoh_cpp/src/rmw_zenoh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1756,16 +1756,12 @@ rmw_send_request(
rmw_zenoh_cpp::create_map_and_set_sequence_num(
&attachment, *sequence_id,
local_gid);
auto free_attachment = rcpputils::make_scope_exit(
[&attachment]() {
z_drop(z_move(attachment));
});
opts.attachment = z_move(attachment);

// See the comment about the "num_in_flight" class variable in the
// rmw_client_data_t class for why we need to do this.
client_data->increment_in_flight_callbacks();

opts.attachment = z_move(attachment);

opts.target = Z_QUERY_TARGET_ALL_COMPLETE;
// The default timeout for a z_get query is 10 seconds and if a response is not received within
Expand Down

0 comments on commit 24f479b

Please sign in to comment.