Skip to content

Commit

Permalink
Take all available samples on service/client on_data_available. (ros2…
Browse files Browse the repository at this point in the history
…#616)

Signed-off-by: Miguel Company <[email protected]>
  • Loading branch information
MiguelCompany authored and Mauro Passerino committed Jan 19, 2023
1 parent f2d26b2 commit ab5af7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ClientListener : public eprosima::fastdds::dds::DataReaderListener
data.is_cdr_buffer = true;
data.data = response.buffer_.get();
data.impl = nullptr; // not used when is_cdr_buffer is true
if (reader->take_next_sample(&data, &response.sample_info_) == ReturnCode_t::RETCODE_OK) {
while (reader->take_next_sample(&data, &response.sample_info_) == ReturnCode_t::RETCODE_OK) {
if (response.sample_info_.valid_data) {
response.sample_identity_ = response.sample_info_.related_sample_identity;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class ServiceListener : public eprosima::fastdds::dds::DataReaderListener
data.is_cdr_buffer = true;
data.data = request.buffer_;
data.impl = nullptr; // not used when is_cdr_buffer is true
if (reader->take_next_sample(&data, &request.sample_info_) == ReturnCode_t::RETCODE_OK) {
while (reader->take_next_sample(&data, &request.sample_info_) == ReturnCode_t::RETCODE_OK) {
if (request.sample_info_.valid_data) {
request.sample_identity_ = request.sample_info_.sample_identity;
// Use response subscriber guid (on related_sample_identity) when present.
Expand Down

0 comments on commit ab5af7d

Please sign in to comment.