Skip to content

Commit 695ef51

Browse files
Avoid forwarding NOT_ALIVE_NO_WRITERS as DISPOSE in keyless topics (#182)
* Avoid forwarding NOT_ALIVE_NO_WRITERS as DISPOSE/UNREGISTER in keyless topics Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com> * Apply revision Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com> * Use NOT_ALIVE mask Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com> --------- Signed-off-by: Emilio Cuesta <emiliocuesta@eprosima.com>
1 parent 66b6537 commit 695ef51

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

ddspipe_participants/src/cpp/reader/dds/CommonReader.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ utils::ReturnCode CommonReader::take_nts_(
223223

224224
EPROSIMA_LOG_INFO(DDSPIPE_DDS_READER, "Taking data in " << participant_id_ << " for topic " << topic_ << ".");
225225

226-
227226
std::unique_ptr<RtpsPayloadData> rtps_data;
228227
fastdds::dds::SampleInfo info;
229228

@@ -329,6 +328,19 @@ bool CommonReader::should_accept_sample_(
329328
return false;
330329
}
331330

331+
// At the time of this writing, the DDS API does not allow to send DISPOSE or UNREGISTER messages
332+
// in keyless topics, and there is no way to request a state transition on the instances living in the
333+
// remote readers. However, those remote readers will still receive a NOT_ALIVE_NO_WRITERS_INSTANCE_STATE
334+
// sample when their associated writers' leaseDurationPeriod expires. Thus, we opt to reject samples
335+
// whose instance state is NOT_ALIVE_NO_WRITERS when they are emitted from a keyless topic.
336+
// The same reasoning applied to any NOT_ALIVE_INSTANCE_STATE, because there is no way to forward
337+
// that changes at the moment.
338+
if (!topic_.topic_qos.keyed &&
339+
(info.instance_state & fastdds::dds::NOT_ALIVE_INSTANCE_STATE))
340+
{
341+
return false;
342+
}
343+
332344
return BaseReader::should_accept_sample_();
333345
}
334346

0 commit comments

Comments
 (0)