From 5b477453dbf60e73807b2f391f87cf7e3f50de35 Mon Sep 17 00:00:00 2001 From: Iker Luengo Date: Fri, 28 Feb 2020 11:09:55 +0100 Subject: [PATCH] Removing unnecessary locators when detecting intraprocess only usecase This is a port of #917 from 1.9.x * Clearing locators when detecting intraprocess only config * Adding is_intraprocess_only() method to RTPSParticipantImpl --- .../rtps/participant/RTPSParticipantImpl.cpp | 20 ++++++++++++++++++- .../rtps/participant/RTPSParticipantImpl.h | 8 ++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index a91714a8404..20b8e621aae 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -54,6 +54,7 @@ #include #include +#include namespace eprosima { namespace fastrtps { @@ -73,6 +74,15 @@ static EntityId_t TrustedWriter( c_EntityId_Unknown; } +static bool should_be_intraprocess_only( + const RTPSParticipantAttributes& att) +{ + return + xmlparser::XMLProfileManager::library_settings().intraprocess_delivery == INTRAPROCESS_FULL && + att.builtin.discovery_config.ignoreParticipantFlags == + (ParticipantFilteringFlags::FILTER_DIFFERENT_HOST | ParticipantFilteringFlags::FILTER_DIFFERENT_PROCESS); +} + Locator_t& RTPSParticipantImpl::applyLocatorAdaptRule( Locator_t& loc) { @@ -101,6 +111,7 @@ RTPSParticipantImpl::RTPSParticipantImpl( , mp_participantListener(plisten) , mp_userParticipant(par) , mp_mutex(new std::recursive_mutex()) + , is_intraprocess_only_(should_be_intraprocess_only(PParam)) { // Builtin transport by default if (PParam.useBuiltinTransports) @@ -125,7 +136,7 @@ RTPSParticipantImpl::RTPSParticipantImpl( { logError(RTPS_PARTICIPANT, "Participant " << m_att.getName() << " with GUID " << m_guid - << " tries to use discovery server over TCP without providing a proper listening port"); + << " tries to use discovery server over TCP without providing a proper listening port"); } } default: @@ -249,6 +260,13 @@ RTPSParticipantImpl::RTPSParticipantImpl( } #endif + if (is_intraprocess_only()) + { + m_att.builtin.metatrafficUnicastLocatorList.clear(); + m_att.defaultUnicastLocatorList.clear(); + m_att.defaultMulticastLocatorList.clear(); + } + createReceiverResources(m_att.builtin.metatrafficMulticastLocatorList, true, false); createReceiverResources(m_att.builtin.metatrafficUnicastLocatorList, true, false); createReceiverResources(m_att.defaultUnicastLocatorList, true, false); diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index 9a0011fba56..1134e366462 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -341,6 +341,11 @@ class RTPSParticipantImpl fastdds::dds::builtin::TypeLookupManager* typelookup_manager() const; + bool is_intraprocess_only() const + { + return is_intraprocess_only_; + } + NetworkFactory& network_factory() { return m_network_Factory; @@ -511,6 +516,9 @@ class RTPSParticipantImpl //!Participant Mutex std::recursive_mutex* mp_mutex; + //!Will this participant use intraprocess only? + bool is_intraprocess_only_; + /* * Flow controllers for this participant. */