From f23113336f8d7f59385b4c270d0df3fec0df21e5 Mon Sep 17 00:00:00 2001 From: cferreiragonz Date: Wed, 12 Jun 2024 12:32:59 +0200 Subject: [PATCH] Refs #21170: Support DS servers connection Signed-off-by: cferreiragonz --- .../builtin/discovery/participant/PDPServer.cpp | 10 ---------- src/cpp/rtps/participant/RTPSParticipantImpl.cpp | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp index 0eaed35dc02..14772442e4c 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp @@ -485,16 +485,6 @@ bool PDPServer::create_ds_pdp_reliable_endpoints( wout->reader_data_filter(pdp_filter); // Enable separate sending so the filter can be called for each change and reader proxy wout->set_separate_sending(true); - - if (!secure) - { - eprosima::shared_lock disc_lock(mp_builtin->getDiscoveryMutex()); - - for (const eprosima::fastdds::rtps::RemoteServerAttributes& it : mp_builtin->m_DiscoveryServers) - { - match_pdp_reader_nts_(it); - } - } } // Could not create PDP Writer, so return false else diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp index 7a3336fbf7b..1322fa9db2d 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.cpp +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.cpp @@ -333,6 +333,21 @@ RTPSParticipantImpl::RTPSParticipantImpl( } }); } + for (fastdds::rtps::RemoteServerAttributes& it : m_att.builtin.discovery_config.m_DiscoveryServers) + { + std::for_each(it.metatrafficUnicastLocatorList.begin(), + it.metatrafficUnicastLocatorList.end(), [&](Locator_t& locator) + { + // TCP DS default logical port is the same as the physical one + if (locator.kind == LOCATOR_KIND_TCPv4 || locator.kind == LOCATOR_KIND_TCPv6) + { + if (IPLocator::getLogicalPort(locator) == 0) + { + IPLocator::setLogicalPort(locator, IPLocator::getPhysicalPort(locator)); + } + } + }); + } } } break;