From 2cfa97c96e17d82532d0e0f9fdb75d80aad4e468 Mon Sep 17 00:00:00 2001 From: yuanyuyuan Date: Thu, 7 Nov 2024 22:51:37 +0800 Subject: [PATCH] fix: adjust the merge --- rmw_zenoh_cpp/src/detail/rmw_data_types.cpp | 11 ++++------- rmw_zenoh_cpp/src/detail/rmw_service_data.cpp | 1 - rmw_zenoh_cpp/src/detail/zenoh_utils.cpp | 4 ++-- rmw_zenoh_cpp/src/detail/zenoh_utils.hpp | 3 +-- rmw_zenoh_cpp/src/rmw_zenoh.cpp | 8 -------- 5 files changed, 7 insertions(+), 20 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/rmw_data_types.cpp b/rmw_zenoh_cpp/src/detail/rmw_data_types.cpp index 00ac12cd..dd9dcfd1 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_data_types.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_data_types.cpp @@ -19,6 +19,7 @@ #include "logging_macros.hpp" #include "rmw_data_types.hpp" +#include #include "rmw/impl/cpp/macros.hpp" @@ -165,7 +166,9 @@ void client_data_handler(z_loaned_reply_t * reply, void * data) if (z_reply_is_ok(reply)) { z_owned_reply_t owned_reply; z_reply_clone(&owned_reply, reply); - client_data->add_new_reply(std::make_unique(owned_reply)); + std::chrono::nanoseconds::rep received_timestamp = + std::chrono::system_clock::now().time_since_epoch().count(); + client_data->add_new_reply(std::make_unique(owned_reply, received_timestamp)); } else { z_view_string_t keystr; z_keyexpr_as_view_string(z_loan(client_data->keyexpr), &keystr); @@ -183,12 +186,6 @@ void client_data_handler(z_loaned_reply_t * reply, void * data) return; } - std::chrono::nanoseconds::rep received_timestamp = - std::chrono::system_clock::now().time_since_epoch().count(); - - client_data->add_new_reply(std::make_unique(reply, received_timestamp)); - // Since we took ownership of the reply, null it out here - *reply = z_reply_null(); } void client_data_drop(void * data) diff --git a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp index ee0af35f..5cb53d58 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp @@ -317,7 +317,6 @@ rmw_ret_t ServiceData::take_request( memcpy(request_header->request_id.writer_guid, attachment.source_gid, RMW_GID_STORAGE_SIZE); - request_header->source_timestamp = attachment.source_timestamp; if (request_header->source_timestamp < 0) { RMW_SET_ERROR_MSG("Failed to get source_timestamp from client call attachment"); diff --git a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp index 8c39a513..f8f61a2e 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp @@ -44,10 +44,10 @@ const z_loaned_query_t * ZenohQuery::get_query() const {return z_loan(query_);} ///============================================================================= ZenohReply::ZenohReply( - const z_owned_reply_t * reply, + z_owned_reply_t reply, std::chrono::nanoseconds::rep received_timestamp) { - reply_ = *reply; + reply_ = reply; received_timestamp_ = received_timestamp; } diff --git a/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp b/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp index 4e291c58..97e1446f 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp @@ -18,7 +18,6 @@ #include #include -#include #include #include "rmw/types.h" @@ -36,7 +35,7 @@ create_map_and_set_sequence_num( class ZenohReply final { public: - ZenohReply(const z_owned_reply_t * reply, std::chrono::nanoseconds::rep received_timestamp); + ZenohReply(z_owned_reply_t reply, std::chrono::nanoseconds::rep received_timestamp); ~ZenohReply(); diff --git a/rmw_zenoh_cpp/src/rmw_zenoh.cpp b/rmw_zenoh_cpp/src/rmw_zenoh.cpp index b6d66ad7..920b12dd 100644 --- a/rmw_zenoh_cpp/src/rmw_zenoh.cpp +++ b/rmw_zenoh_cpp/src/rmw_zenoh.cpp @@ -1874,14 +1874,6 @@ rmw_take_response( return RMW_RET_ERROR; } - if (!rmw_zenoh_cpp::get_gid_from_attachment( - &sample->attachment, - request_header->request_id.writer_guid)) - { - RMW_SET_ERROR_MSG("Could not get client gid from attachment"); - return RMW_RET_ERROR; - } - request_header->received_timestamp = latest_reply->get_received_timestamp(); z_drop(z_move(payload));