diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp index 8542c443c17..42a81edc539 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp @@ -801,6 +801,32 @@ bool get_server_client_default_guidPrefix( return false; } +bool PDPClient::remove_remote_participant( + const GUID_t& partGUID, + ParticipantDiscoveryInfo::DISCOVERY_STATUS reason) +{ + if(PDP::remove_remote_participant(partGUID, reason)) + { + // If it works fine, return + return true; + } + + // Erase Proxies created before having the Participant + GUID_t wguid; + wguid.guidPrefix = partGUID.guidPrefix; + wguid.entityId = c_EntityId_SPDPWriter; + mp_PDPReader->matched_writer_remove(wguid); + + GUID_t rguid; + rguid.guidPrefix = partGUID.guidPrefix; + rguid.entityId = c_EntityId_SPDPReader; + mp_PDPWriter->matched_reader_remove(rguid); + + update_remote_servers_list(); + + return false; +} + } /* namespace rtps */ } /* namespace fastdds */ } /* namespace eprosima */ diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPClient.h b/src/cpp/rtps/builtin/discovery/participant/PDPClient.h index 925e0ac070b..aaaafd4f248 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPClient.h +++ b/src/cpp/rtps/builtin/discovery/participant/PDPClient.h @@ -122,6 +122,16 @@ class PDPClient : public PDP void notifyAboveRemoteEndpoints( const ParticipantProxyData& pdata) override; + /** + * This method removes a remote RTPSParticipant and all its writers and readers. + * @param participant_guid GUID_t of the remote RTPSParticipant. + * @param reason Why the participant is being removed (dropped vs removed) + * @return true if correct. + */ + bool remove_remote_participant( + const GUID_t& participant_guid, + ParticipantDiscoveryInfo::DISCOVERY_STATUS reason) override; + /** * Matching server EDP endpoints * @return true if all servers have been discovered