Skip to content

Commit 9bcdb4b

Browse files
committed
Refs #23919. Fix cornercase
Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
1 parent 03e65f2 commit 9bcdb4b

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

examples/cpp/content_filter/SubscriberApp.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ class SubscriberApp : public Application, public DataReaderListener
6464
DataReader* reader,
6565
const SubscriptionMatchedStatus& info) override;
6666

67+
void on_sample_lost(
68+
DataReader*,
69+
const SampleLostStatus& status) override
70+
{
71+
std::cout << "Sample lost: " << status.total_count << std::endl;
72+
}
73+
6774
//! Run subscriber
6875
void run() override;
6976

src/cpp/rtps/writer/StatefulWriter.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,15 @@ DeliveryRetCode StatefulWriter::deliver_sample_to_network(
649649
{
650650
SequenceNumber_t gap_seq;
651651
FragmentNumber_t next_unsent_frag = 0;
652+
653+
if (SequenceNumber_t::unknown() != (*remote_reader)->first_irrelevant_removed())
654+
{
655+
// Send GAP with irrelevant changes that are not in history.
656+
group.sender(this, (*remote_reader)->message_sender());
657+
add_gaps_for_removed_irrelevants(**remote_reader, group);
658+
group.sender(this, &locator_selector); // This makes the flush_and_reset().
659+
}
660+
652661
if ((*remote_reader)->change_is_unsent(change->sequenceNumber, next_unsent_frag, gap_seq, get_seq_num_min(),
653662
need_reactivate_periodic_heartbeat) &&
654663
(0 == n_fragments || min_unsent_fragment >= next_unsent_frag))
@@ -665,14 +674,6 @@ DeliveryRetCode StatefulWriter::deliver_sample_to_network(
665674
should_be_sent = true;
666675
inline_qos |= (*remote_reader)->expects_inline_qos();
667676

668-
if (SequenceNumber_t::unknown() != (*remote_reader)->first_irrelevant_removed())
669-
{
670-
// Send GAP with irrelevant changes that are not in history.
671-
group.sender(this, (*remote_reader)->message_sender());
672-
add_gaps_for_removed_irrelevants(**remote_reader, group);
673-
group.sender(this, &locator_selector); // This makes the flush_and_reset().
674-
}
675-
676677
// If there is a hole (removed from history or not relevants) between previous sample and this one,
677678
// send it a personal GAP.
678679
if (SequenceNumber_t::unknown() != gap_seq)

0 commit comments

Comments
 (0)