From 3fdfa934a051e2c46ff510e632d7f68e81f9deb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Gonz=C3=A1lez=20Moreno?= Date: Thu, 15 Jul 2021 15:51:21 +0200 Subject: [PATCH] Refs #12133. Continue the search after found a future change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ricardo González Moreno --- .../DataReaderImpl/ReadTakeCommand.hpp | 61 +++++++++---------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/src/cpp/fastdds/subscriber/DataReaderImpl/ReadTakeCommand.hpp b/src/cpp/fastdds/subscriber/DataReaderImpl/ReadTakeCommand.hpp index 5800bdc8cd4..d7ca53d4d25 100644 --- a/src/cpp/fastdds/subscriber/DataReaderImpl/ReadTakeCommand.hpp +++ b/src/cpp/fastdds/subscriber/DataReaderImpl/ReadTakeCommand.hpp @@ -140,39 +140,38 @@ struct ReadTakeCommand // If the change is in the future we can skip the remaining changes in the history, as they will be // in the future also - if (is_future_change) + if (!is_future_change) { - break; - } - - // Add sample and info to collections - ReturnCode_t previous_return_value = return_value_; - bool added = add_sample(change, remove_change); - reader_->end_sample_access_nts(change, wp, added); - // Check if the payload is dirty - if (added && !check_datasharing_validity(change, data_values_.has_ownership(), wp)) - { - // Decrement length of collections - --current_slot_; - ++remaining_samples_; - data_values_.length(current_slot_); - sample_infos_.length(current_slot_); - - return_value_ = previous_return_value; - finished_ = false; - - remove_change = true; - added = false; - } - - if (remove_change || (added && take_samples)) - { - // Remove from history - history_.remove_change_sub(change, it); - - // Current iterator will point to change next to the one removed. Avoid incrementing. - continue; + // Add sample and info to collections + ReturnCode_t previous_return_value = return_value_; + bool added = add_sample(change, remove_change); + reader_->end_sample_access_nts(change, wp, added); + + // Check if the payload is dirty + if (added && !check_datasharing_validity(change, data_values_.has_ownership(), wp)) + { + // Decrement length of collections + --current_slot_; + ++remaining_samples_; + data_values_.length(current_slot_); + sample_infos_.length(current_slot_); + + return_value_ = previous_return_value; + finished_ = false; + + remove_change = true; + added = false; + } + + if (remove_change || (added && take_samples)) + { + // Remove from history + history_.remove_change_sub(change, it); + + // Current iterator will point to change next to the one removed. Avoid incrementing. + continue; + } } }