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

[21055] Automatically unmatch remote participants on participant deletion (backport #4849) #4864

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions include/fastdds/rtps/builtin/discovery/participant/PDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ class PDP
*/
bool enable();

/**
* @brief Disable the Participant Discovery Protocol
*/
void disable();

virtual bool init(
RTPSParticipantImpl* part) = 0;

Expand Down Expand Up @@ -576,6 +581,22 @@ class PDP
*/
void set_external_participant_properties_(
ParticipantProxyData* participant_data);

/**
* Performs all the necessary actions after removing a ParticipantProxyData from the
* participant_proxies_ collection.
*
* @param pdata ParticipantProxyData that was removed.
* @param partGUID GUID of the removed participant.
* @param reason Reason why the participant was removed.
* @param listener Listener to be notified of the unmatches / removal.
*/
void actions_on_remote_participant_removed(
ParticipantProxyData* pdata,
const GUID_t& partGUID,
ParticipantDiscoveryInfo::DISCOVERY_STATUS reason,
RTPSParticipantListener* listener);

};


Expand Down
25 changes: 14 additions & 11 deletions src/cpp/rtps/builtin/BuiltinProtocols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ BuiltinProtocols::BuiltinProtocols()
BuiltinProtocols::~BuiltinProtocols()
{
// Send participant is disposed
if (mp_PDP != nullptr)
if (nullptr != mp_PDP)
{
// Send participant is disposed
mp_PDP->announceParticipantState(true, true);
// Consider all discovered participants as disposed
mp_PDP->disable();
}

// TODO Auto-generated destructor stub
Expand Down Expand Up @@ -194,7 +197,7 @@ bool BuiltinProtocols::addLocalWriter(
{
bool ok = true;

if (mp_PDP != nullptr)
if (nullptr != mp_PDP)
{
ok = mp_PDP->getEDP()->newLocalWriterProxyData(w, topicAtt, wqos);

Expand All @@ -209,7 +212,7 @@ bool BuiltinProtocols::addLocalWriter(
EPROSIMA_LOG_WARNING(RTPS_EDP, "EDP is not used in this Participant, register a Writer is impossible");
}

if (mp_WLP != nullptr)
if (nullptr != mp_WLP)
{
ok &= mp_WLP->add_local_writer(w, wqos);
}
Expand All @@ -229,7 +232,7 @@ bool BuiltinProtocols::addLocalReader(
{
bool ok = true;

if (mp_PDP != nullptr)
if (nullptr != mp_PDP)
{
ok = mp_PDP->getEDP()->newLocalReaderProxyData(R, topicAtt, rqos, content_filter);

Expand All @@ -244,7 +247,7 @@ bool BuiltinProtocols::addLocalReader(
EPROSIMA_LOG_WARNING(RTPS_EDP, "EDP is not used in this Participant, register a Reader is impossible");
}

if (mp_WLP != nullptr)
if (nullptr != mp_WLP)
{
ok &= mp_WLP->add_local_reader(R, rqos);
}
Expand All @@ -258,7 +261,7 @@ bool BuiltinProtocols::updateLocalWriter(
const WriterQos& wqos)
{
bool ok = false;
if (mp_PDP != nullptr && mp_PDP->getEDP() != nullptr)
if ((nullptr != mp_PDP) && (nullptr != mp_PDP->getEDP()))
{
ok = mp_PDP->getEDP()->updatedLocalWriter(W, topicAtt, wqos);
}
Expand All @@ -272,7 +275,7 @@ bool BuiltinProtocols::updateLocalReader(
const fastdds::rtps::ContentFilterProperty* content_filter)
{
bool ok = false;
if (mp_PDP != nullptr && mp_PDP->getEDP() != nullptr)
if ((nullptr != mp_PDP) && (nullptr != mp_PDP->getEDP()))
{
ok = mp_PDP->getEDP()->updatedLocalReader(R, topicAtt, rqos, content_filter);
}
Expand All @@ -283,11 +286,11 @@ bool BuiltinProtocols::removeLocalWriter(
RTPSWriter* W)
{
bool ok = false;
if (mp_WLP != nullptr)
if (nullptr != mp_WLP)
{
ok |= mp_WLP->remove_local_writer(W);
}
if (mp_PDP != nullptr && mp_PDP->getEDP() != nullptr)
if ((nullptr != mp_PDP) && (nullptr != mp_PDP->getEDP()))
{
ok |= mp_PDP->getEDP()->removeLocalWriter(W);
}
Expand All @@ -298,11 +301,11 @@ bool BuiltinProtocols::removeLocalReader(
RTPSReader* R)
{
bool ok = false;
if (mp_WLP != nullptr)
if (nullptr != mp_WLP)
{
ok |= mp_WLP->remove_local_reader(R);
}
if (mp_PDP != nullptr && mp_PDP->getEDP() != nullptr)
if ((nullptr != mp_PDP) && (nullptr != mp_PDP->getEDP()))
{
ok |= mp_PDP->getEDP()->removeLocalReader(R);
}
Expand Down
Loading
Loading