Skip to content

Commit

Permalink
Remove unnecessary (and incorrect) copy of sequence_number
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette committed Jan 11, 2024
1 parent 735c048 commit 37f44b5
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions rmw_zenoh_cpp/src/rmw_zenoh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,6 @@ rmw_take_response(

std::lock_guard<std::mutex> lock(client_data->message_mutex);
if (client_data->replies.empty()) {
// TODO(francocipollone): Verify behavior.
RCUTILS_LOG_ERROR_NAMED("rmw_zenoh_cpp", "[rmw_take_response] Response message is empty");
return RMW_RET_ERROR;
}
Expand Down Expand Up @@ -2613,12 +2612,6 @@ rmw_send_response(

size_t data_length = ser.getSerializedDataLength();

size_t meta_length = sizeof(request_header->sequence_number);
memcpy(
&response_bytes[data_length],
reinterpret_cast<char *>(&request_header->sequence_number),
meta_length);

// Create the queryable payload
std::lock_guard<std::mutex> lock(service_data->sequence_to_query_map_mutex);
auto query_it = service_data->sequence_to_query_map.find(request_header->sequence_number);
Expand All @@ -2645,7 +2638,7 @@ rmw_send_response(
options.encoding = z_encoding(Z_ENCODING_PREFIX_EMPTY, NULL);
z_query_reply(
&loaned_query, z_loan(service_data->keyexpr), reinterpret_cast<const uint8_t *>(
response_bytes), data_length + meta_length, &options);
response_bytes), data_length, &options);

z_drop(z_move(query_it->second));
service_data->sequence_to_query_map.erase(query_it);
Expand Down

0 comments on commit 37f44b5

Please sign in to comment.