Skip to content

Commit d38f770

Browse files
committed
Refs #22929. Avoid processing fake samples in PubSubReader.
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
1 parent 231d4c9 commit d38f770

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

test/blackbox/api/dds-pim/PubSubReader.hpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,10 @@ class PubSubReader
17851785

17861786
if (eprosima::fastdds::dds::RETCODE_OK == datareader_->take(data_seq, info_seq))
17871787
{
1788-
current_processed_count_++;
1788+
if (info_seq[0].sample_identity != eprosima::fastdds::rtps::SampleIdentity::unknown())
1789+
{
1790+
current_processed_count_++;
1791+
}
17891792
return true;
17901793
}
17911794
return false;
@@ -1797,7 +1800,10 @@ class PubSubReader
17971800
eprosima::fastdds::dds::SampleInfo dds_info;
17981801
if (datareader_->take_next_sample(data, &dds_info) == eprosima::fastdds::dds::RETCODE_OK)
17991802
{
1800-
current_processed_count_++;
1803+
if (dds_info.sample_identity != eprosima::fastdds::rtps::SampleIdentity::unknown())
1804+
{
1805+
current_processed_count_++;
1806+
}
18011807
return true;
18021808
}
18031809
return false;
@@ -2017,7 +2023,8 @@ class PubSubReader
20172023
ReturnCode_t success = take_ ?
20182024
datareader->take_next_sample((void*)&data, &info) :
20192025
datareader->read_next_sample((void*)&data, &info);
2020-
if (eprosima::fastdds::dds::RETCODE_OK == success)
2026+
if ((eprosima::fastdds::dds::RETCODE_OK == success) &&
2027+
(info.sample_identity != eprosima::fastdds::rtps::SampleIdentity::unknown()))
20212028
{
20222029
returnedValue = true;
20232030

@@ -2071,6 +2078,11 @@ class PubSubReader
20712078
type& data = datas[i];
20722079
eprosima::fastdds::dds::SampleInfo& info = infos[i];
20732080

2081+
if (info.sample_identity == eprosima::fastdds::rtps::SampleIdentity::unknown())
2082+
{
2083+
continue; // Skip unknown samples
2084+
}
2085+
20742086
// Check order of changes.
20752087
LastSeqInfo seq_info{ info.instance_handle, info.sample_identity.writer_guid() };
20762088
ASSERT_LT(last_seq[seq_info], info.sample_identity.sequence_number());

0 commit comments

Comments
 (0)