Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication improvement sending only one GAP for all readers [12576] #2227

Merged
merged 1 commit into from
Sep 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 32 additions & 4 deletions src/cpp/rtps/writer/StatefulWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ DeliveryRetCode StatefulWriter::deliver_sample_to_network(
while (DeliveryRetCode::DELIVERED == ret_code &&
min_unsent_fragment != n_fragments + 1)
{
SequenceNumber_t gap_seq_for_all = SequenceNumber_t::unknown();
locator_selector.locator_selector.reset(false);
auto first_relevant_reader = matched_remote_readers_.begin();
bool inline_qos = false;
Expand Down Expand Up @@ -735,10 +736,32 @@ DeliveryRetCode StatefulWriter::deliver_sample_to_network(
// send it a personal GAP.
if (SequenceNumber_t::unknown() != gap_seq)
{
group.sender(this, (*remote_reader)->message_sender());
group.add_gap(gap_seq, SequenceNumberSet_t(change->sequenceNumber), (*remote_reader)->guid());
send_heartbeat_nts_(1u, group, disable_positive_acks_);
group.sender(this, &locator_selector); // This makes the flush_and_reset().
if (SequenceNumber_t::unknown() == gap_seq_for_all) // Calculate if the hole is for all readers
{
History::const_iterator chit = mp_history->find_change_nts(change);

if (chit == mp_history->changesBegin())
{
gap_seq_for_all = gap_seq;
}
else
{
SequenceNumber_t prev = (*std::prev(chit))->sequenceNumber + 1;

if (prev == gap_seq)
{
gap_seq_for_all = gap_seq;
}
}
}

if (gap_seq_for_all != gap_seq) // If it is an individual GAP, sent it to repective reader.
{
group.sender(this, (*remote_reader)->message_sender());
group.add_gap(gap_seq, SequenceNumberSet_t(change->sequenceNumber), (*remote_reader)->guid());
send_heartbeat_nts_(1u, group, disable_positive_acks_);
group.sender(this, &locator_selector); // This makes the flush_and_reset().
}
}
}
else
Expand All @@ -747,6 +770,11 @@ DeliveryRetCode StatefulWriter::deliver_sample_to_network(
}
}

if (SequenceNumber_t::unknown() != gap_seq_for_all) // Send GAP for all readers
{
group.add_gap(gap_seq_for_all, SequenceNumberSet_t(change->sequenceNumber));
}

try
{
if (should_be_sent)
Expand Down