Skip to content

Commit

Permalink
Refs #20181: Add Fix
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
  • Loading branch information
Mario-DL committed Jul 16, 2024
1 parent b9e0843 commit 4a3afd3
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,34 @@ bool PDPSimple::createPDPEndpoints()
secure_endpoints->secure_reader.listener_.reset(new PDPListener(this));

endpoints = secure_endpoints;
endpoints->reader.listener_.reset(new PDPSecurityInitiatorListener(this));
endpoints->reader.listener_.reset(new PDPSecurityInitiatorListener(this,
[this](const ParticipantProxyData& participant_data)
{
auto secure_pdp_endpoints =
static_cast<fastdds::rtps::SimplePDPEndpointsSecure*>(builtin_endpoints_.get());
std::lock_guard<fastdds::RecursiveTimedMutex> wlock(secure_pdp_endpoints->writer.writer_->getMutex());

CacheChange_t* change = nullptr;
secure_pdp_endpoints->writer.history_->get_earliest_change(&change);

if (change != nullptr)
{
std::vector<GUID_t> remote_readers;
LocatorList_t locators;

// Send discovery information through the non-secure PDP writer
remote_readers.emplace_back(participant_data.m_guid.guidPrefix, c_EntityId_SPDPReader);

fastdds::rtps::FakeWriter writer(getRTPSParticipant(), c_EntityId_SPDPWriter);

for (auto& locator : participant_data.metatraffic_locators.unicast)
{
locators.push_back(locator);
}

direct_send(getRTPSParticipant(), locators, remote_readers, *change, writer);
}
}));
}
else
#endif // HAVE_SECURITY
Expand Down

0 comments on commit 4a3afd3

Please sign in to comment.