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

[1.9.x] Removing unnecessary locators when detecting intraprocess only usecase [7041] #917

Merged
merged 2 commits into from
Feb 3, 2020
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
18 changes: 18 additions & 0 deletions src/cpp/rtps/participant/RTPSParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include <algorithm>

#include <fastrtps/log/Log.h>
#include <fastrtps/xmlparser/XMLProfileManager.h>

namespace eprosima {
namespace fastrtps {
Expand All @@ -70,6 +71,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)
{
Expand Down Expand Up @@ -97,6 +107,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)
Expand Down Expand Up @@ -246,6 +257,13 @@ RTPSParticipantImpl::RTPSParticipantImpl(
m_att.defaultUnicastLocatorList);
}

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);

Expand Down
8 changes: 8 additions & 0 deletions src/cpp/rtps/participant/RTPSParticipantImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ class RTPSParticipantImpl

WLP* wlp();

bool is_intraprocess_only() const
{
return is_intraprocess_only_;
}

bool get_remote_writer_info(const GUID_t& writerGuid, WriterProxyData& returnedInfo);

bool get_remote_reader_info(const GUID_t& readerGuid, ReaderProxyData& returnedInfo);
Expand Down Expand Up @@ -420,6 +425,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.
*/
Expand Down