Skip to content

Commit

Permalink
Addressing review.
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <[email protected]>
  • Loading branch information
MiguelCompany committed May 26, 2020
1 parent f4754e5 commit 3e14a6b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rmw_fastrtps_shared_cpp/src/rmw_response.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ __rmw_send_response(
wparams.related_sample_identity().sequence_number().low =
(int32_t)(request_header->sequence_number & 0xFFFFFFFF);

const eprosima::fastrtps::rtps::GUID_t& related_guid =
// According to the list of possible entity kinds in section 9.3.1.2 of RTPS
// readers will have this bit on, while writers will not. We use this to know
// if the related guid is the request writer or the response reader.
constexpr uint8_t entity_id_is_reader_bit = 0x04;
const eprosima::fastrtps::rtps::GUID_t & related_guid =
wparams.related_sample_identity().writer_guid();
if( (related_guid.entityId.value[3] & 0x04) != 0)
if((related_guid.entityId.value[3] & entity_id_is_reader_bit) != 0)
{
// Related guid is a reader, so it is the response subscription guid.
// Wait for the response writer to be matched with it.
Expand All @@ -115,7 +119,7 @@ __rmw_send_response(
return RMW_RET_ERROR;
}
}

rmw_fastrtps_shared_cpp::SerializedData data;
data.is_cdr_buffer = false;
data.data = const_cast<void *>(ros_response);
Expand Down

0 comments on commit 3e14a6b

Please sign in to comment.