diff --git a/include/fastdds/rtps/writer/ReaderProxy.h b/include/fastdds/rtps/writer/ReaderProxy.h index 66f77d4c5e5..b0f605a06fe 100644 --- a/include/fastdds/rtps/writer/ReaderProxy.h +++ b/include/fastdds/rtps/writer/ReaderProxy.h @@ -307,9 +307,10 @@ class ReaderProxy bool check_and_set_acknack_count( uint32_t acknack_count) { - if (last_acknack_count_ < acknack_count) + if (acknack_count >= next_expected_acknack_count_) { - last_acknack_count_ = acknack_count; + next_expected_acknack_count_ = acknack_count; + ++next_expected_acknack_count_; return true; } @@ -442,8 +443,8 @@ class ReaderProxy TimedEvent* initial_heartbeat_event_; //! Are timed events enabled? std::atomic_bool timers_enabled_; - //! Last ack/nack count - uint32_t last_acknack_count_; + //! Next expected ack/nack count + uint32_t next_expected_acknack_count_; //! Last NACKFRAG count. uint32_t last_nackfrag_count_; diff --git a/src/cpp/rtps/writer/ReaderProxy.cpp b/src/cpp/rtps/writer/ReaderProxy.cpp index 2655f87e42f..3a751c989d2 100644 --- a/src/cpp/rtps/writer/ReaderProxy.cpp +++ b/src/cpp/rtps/writer/ReaderProxy.cpp @@ -57,7 +57,7 @@ ReaderProxy::ReaderProxy( , nack_supression_event_(nullptr) , initial_heartbeat_event_(nullptr) , timers_enabled_(false) - , last_acknack_count_(0) + , next_expected_acknack_count_(0) , last_nackfrag_count_(0) { nack_supression_event_ = new TimedEvent(writer_->getRTPSParticipant()->getEventResource(), @@ -166,7 +166,7 @@ void ReaderProxy::stop() disable_timers(); changes_for_reader_.clear(); - last_acknack_count_ = 0; + next_expected_acknack_count_ = 0; last_nackfrag_count_ = 0; changes_low_mark_ = SequenceNumber_t(); }