Skip to content

Commit

Permalink
fix: adjust the merge
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanYuYuan committed Nov 7, 2024
1 parent ec7776e commit 2cfa97c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 20 deletions.
11 changes: 4 additions & 7 deletions rmw_zenoh_cpp/src/detail/rmw_data_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "logging_macros.hpp"
#include "rmw_data_types.hpp"
#include <zenoh_macros.h>

#include "rmw/impl/cpp/macros.hpp"

Expand Down Expand Up @@ -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<ZenohReply>(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<ZenohReply>(owned_reply, received_timestamp));
} else {
z_view_string_t keystr;
z_keyexpr_as_view_string(z_loan(client_data->keyexpr), &keystr);
Expand All @@ -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<ZenohReply>(reply, received_timestamp));
// Since we took ownership of the reply, null it out here
*reply = z_reply_null();
}

void client_data_drop(void * data)
Expand Down
1 change: 0 additions & 1 deletion rmw_zenoh_cpp/src/detail/rmw_service_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions rmw_zenoh_cpp/src/detail/zenoh_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions rmw_zenoh_cpp/src/detail/zenoh_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <zenoh.h>

#include <chrono>
#include <functional>
#include <optional>

#include "rmw/types.h"
Expand All @@ -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();

Expand Down
8 changes: 0 additions & 8 deletions rmw_zenoh_cpp/src/rmw_zenoh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 2cfa97c

Please sign in to comment.