Skip to content

Commit

Permalink
Ignore ignored participants and endpoints (#113)
Browse files Browse the repository at this point in the history
* Ignore ignored participants and endpoints

Signed-off-by: Juan Lopez Fernandez <[email protected]>

* Piggyback: remove redundant method

Signed-off-by: Juan Lopez Fernandez <[email protected]>

---------

Signed-off-by: Juan Lopez Fernandez <[email protected]>
  • Loading branch information
juanlofer-eprosima authored Dec 19, 2024
1 parent 4799303 commit 205685c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ class SpyDdsParticipant : public ddspipe::participants::DynTypesParticipant
void internal_notify_endpoint_discovered_(
const EndpointInfo& endpoint_discovered);

bool come_from_this_participant_(
const ddspipe::core::types::Guid& guid) const noexcept;

//! Participants Internal Reader
std::shared_ptr<ddspipe::participants::InternalReader> participants_reader_;

Expand Down
26 changes: 7 additions & 19 deletions fastddsspy_participants/src/cpp/participant/SpyDdsParticipant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void SpyDdsParticipant::on_participant_discovery(
bool& should_be_ignored)
{
// If comes from this participant is not interesting
if (come_from_this_participant_(info.guid))
if (ddspipe::participants::detail::come_from_same_participant_(info.guid, rtps_participant_->getGuid()))
{
return;
}
Expand All @@ -85,15 +85,14 @@ void SpyDdsParticipant::on_reader_discovery(
bool& should_be_ignored)
{
// If comes from this participant is not interesting
if (come_from_this_participant_(info.guid))
if (ddspipe::participants::detail::come_from_same_participant_(info.guid, rtps_participant_->getGuid()))
{
return;
}

EndpointInfo endpoint_info = ddspipe::participants::detail::create_endpoint_from_info_(info, id());

// If participant left or dropped, this notification arrives as well
endpoint_info.active = !(reason == fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER);
endpoint_info.active = (reason == fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER
|| reason == fastdds::rtps::ReaderDiscoveryStatus::CHANGED_QOS_READER);

ddspipe::participants::DynTypesParticipant::on_reader_discovery(participant, reason, info, should_be_ignored);

Expand All @@ -107,15 +106,14 @@ void SpyDdsParticipant::on_writer_discovery(
bool& should_be_ignored)
{
// If comes from this participant is not interesting
if (come_from_this_participant_(info.guid))
if (ddspipe::participants::detail::come_from_same_participant_(info.guid, rtps_participant_->getGuid()))
{
return;
}

EndpointInfo endpoint_info = ddspipe::participants::detail::create_endpoint_from_info_(info, id());

// If participant left or dropped, this notification arrives as well
endpoint_info.active = !(reason == fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER);
endpoint_info.active = (reason == fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER
|| reason == fastdds::rtps::WriterDiscoveryStatus::CHANGED_QOS_WRITER);

ddspipe::participants::DynTypesParticipant::on_writer_discovery(participant, reason, info, should_be_ignored);

Expand Down Expand Up @@ -144,16 +142,6 @@ void SpyDdsParticipant::internal_notify_endpoint_discovered_(
endpoints_reader_->simulate_data_reception(std::move(data));
}

/*
* NOTE: this function is required apart from come_from_same_participant_
* because this participant has 2 guids, the rtps and the dds participant ones
*/
bool SpyDdsParticipant::come_from_this_participant_(
const ddspipe::core::types::Guid& guid) const noexcept
{
return (guid.guid_prefix() == rtps_participant_->getGuid().guidPrefix);
}

} /* namespace participants */
} /* namespace spy */
} /* namespace eprosima */

0 comments on commit 205685c

Please sign in to comment.