From 6623fa83f0c48ce8b23dc676f467c340adb40b6a Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Tue, 20 Feb 2024 16:59:51 +0100 Subject: [PATCH 01/11] Refs #20492: New outputchannel related methods with locator selector entry argument Signed-off-by: Jesus Perez --- .../rtps/transport/TransportInterface.h | 12 +++++ src/cpp/CMakeLists.txt | 1 + src/cpp/rtps/transport/TransportInterface.cpp | 54 +++++++++++++++++++ test/unittest/dds/publisher/CMakeLists.txt | 1 + test/unittest/rtps/network/CMakeLists.txt | 1 + test/unittest/statistics/dds/CMakeLists.txt | 3 +- test/unittest/transport/CMakeLists.txt | 5 ++ 7 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/cpp/rtps/transport/TransportInterface.cpp diff --git a/include/fastdds/rtps/transport/TransportInterface.h b/include/fastdds/rtps/transport/TransportInterface.h index 60dec2d299f..568aead58ab 100644 --- a/include/fastdds/rtps/transport/TransportInterface.h +++ b/include/fastdds/rtps/transport/TransportInterface.h @@ -135,6 +135,18 @@ class RTPS_DllAPI TransportInterface SendResourceList& sender_resource_list, const Locator&) = 0; + //! Must open the channel that maps to/from the given locator selector entry. This method must allocate, + //! reserve and mark any resources that are needed for said channel. + virtual bool OpenOutputChannel( + SendResourceList& sender_resource_list, + const fastrtps::rtps::LocatorSelectorEntry&); + + + //! Close the channel that maps to/from the given locator selector entry. + virtual void CloseOutputChannel( + SendResourceList& sender_resource_list, + const fastrtps::rtps::LocatorSelectorEntry&); + /** Opens an input channel to receive incoming connections. * If there is an existing channel it registers the receiver interface. */ diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index c82588394b3..94d6b578bed 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -124,6 +124,7 @@ set(${PROJECT_NAME}_source_files fastdds/builtin/typelookup/TypeLookupManager.cpp fastdds/builtin/typelookup/TypeLookupRequestListener.cpp fastdds/builtin/typelookup/TypeLookupReplyListener.cpp + rtps/transport/TransportInterface.cpp rtps/transport/ChainingTransport.cpp rtps/transport/ChannelResource.cpp rtps/transport/PortBasedTransportDescriptor.cpp diff --git a/src/cpp/rtps/transport/TransportInterface.cpp b/src/cpp/rtps/transport/TransportInterface.cpp new file mode 100644 index 00000000000..4912aff3851 --- /dev/null +++ b/src/cpp/rtps/transport/TransportInterface.cpp @@ -0,0 +1,54 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include + + +namespace eprosima { +namespace fastdds { +namespace rtps { + +using LocatorSelectorEntry = fastrtps::rtps::LocatorSelectorEntry; + +bool TransportInterface::OpenOutputChannel( + SendResourceList& send_resource_list, + const LocatorSelectorEntry& locator_selector_entry) +{ + bool success = false; + for (size_t i = 0; i < locator_selector_entry.state.multicast.size(); ++i) + { + size_t index = locator_selector_entry.state.multicast[i]; + success |= OpenOutputChannel(send_resource_list, locator_selector_entry.multicast[index]); + } + for (size_t i = 0; i < locator_selector_entry.state.unicast.size(); ++i) + { + size_t index = locator_selector_entry.state.unicast[i]; + success |= OpenOutputChannel(send_resource_list, locator_selector_entry.unicast[index]); + } + return success; +} + +void TransportInterface::CloseOutputChannel( + SendResourceList& sender_resource_list, + const fastrtps::rtps::LocatorSelectorEntry& locator_selector_entry) +{ + static_cast(sender_resource_list); + static_cast(locator_selector_entry); +} + +} // namespace rtps +} // namespace fastrtps +} // namespace eprosima diff --git a/test/unittest/dds/publisher/CMakeLists.txt b/test/unittest/dds/publisher/CMakeLists.txt index dfa667f5691..3bd42f2e22d 100644 --- a/test/unittest/dds/publisher/CMakeLists.txt +++ b/test/unittest/dds/publisher/CMakeLists.txt @@ -166,6 +166,7 @@ set(DATAWRITERTESTS_SOURCE DataWriterTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEventImpl.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/RTPSDomain.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/shared_mem/SharedMemTransportDescriptor.cpp diff --git a/test/unittest/rtps/network/CMakeLists.txt b/test/unittest/rtps/network/CMakeLists.txt index e09a47ebd80..c2bd3151ea9 100644 --- a/test/unittest/rtps/network/CMakeLists.txt +++ b/test/unittest/rtps/network/CMakeLists.txt @@ -29,6 +29,7 @@ set(NETWORKFACTORYTESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/ResourceEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEventImpl.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/tcp/RTCPMessageManager.cpp diff --git a/test/unittest/statistics/dds/CMakeLists.txt b/test/unittest/statistics/dds/CMakeLists.txt index 9e6b862fc10..eace6ddeb7e 100644 --- a/test/unittest/statistics/dds/CMakeLists.txt +++ b/test/unittest/statistics/dds/CMakeLists.txt @@ -241,6 +241,7 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEventImpl.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/RTPSDomain.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/shared_mem/SharedMemTransportDescriptor.cpp @@ -433,6 +434,7 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/ResourceEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEventImpl.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TCPAcceptor.cpp @@ -671,4 +673,3 @@ if (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) gtest_discover_tests(StatisticsDomainParticipantStatusQueryableTests) endif (SQLITE3_SUPPORT AND FASTDDS_STATISTICS AND NOT QNX) - diff --git a/test/unittest/transport/CMakeLists.txt b/test/unittest/transport/CMakeLists.txt index 05f83080b4b..eff0c9ecdd6 100644 --- a/test/unittest/transport/CMakeLists.txt +++ b/test/unittest/transport/CMakeLists.txt @@ -76,6 +76,7 @@ set(UDPV4TESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/Time_t.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/flowcontrol/ThroughputControllerDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/network/NetworkFactory.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/UDPChannelResource.cpp @@ -99,6 +100,7 @@ set(UDPV6TESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/Time_t.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/flowcontrol/ThroughputControllerDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/network/NetworkFactory.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/UDPChannelResource.cpp @@ -129,6 +131,7 @@ set(TCPV4TESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/ResourceEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEventImpl.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/tcp/RTCPMessageManager.cpp @@ -172,6 +175,7 @@ set(TCPV6TESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/ResourceEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEvent.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/resources/TimedEventImpl.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/tcp/RTCPMessageManager.cpp @@ -210,6 +214,7 @@ set(SHAREDMEMTESTS_SOURCE ${PROJECT_SOURCE_DIR}/src/cpp/rtps/common/Time_t.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/flowcontrol/ThroughputControllerDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/network/NetworkFactory.cpp + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/shared_mem/SharedMemTransport.cpp From d26949e1d0238b5040adb3a29fb05d9561ebdfab Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Tue, 20 Feb 2024 17:00:45 +0100 Subject: [PATCH 02/11] Refs #20492: Uncrustify Signed-off-by: Jesus Perez --- src/cpp/rtps/transport/TransportInterface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cpp/rtps/transport/TransportInterface.cpp b/src/cpp/rtps/transport/TransportInterface.cpp index 4912aff3851..0a1104bee79 100644 --- a/src/cpp/rtps/transport/TransportInterface.cpp +++ b/src/cpp/rtps/transport/TransportInterface.cpp @@ -24,8 +24,8 @@ namespace rtps { using LocatorSelectorEntry = fastrtps::rtps::LocatorSelectorEntry; bool TransportInterface::OpenOutputChannel( - SendResourceList& send_resource_list, - const LocatorSelectorEntry& locator_selector_entry) + SendResourceList& send_resource_list, + const LocatorSelectorEntry& locator_selector_entry) { bool success = false; for (size_t i = 0; i < locator_selector_entry.state.multicast.size(); ++i) @@ -42,8 +42,8 @@ bool TransportInterface::OpenOutputChannel( } void TransportInterface::CloseOutputChannel( - SendResourceList& sender_resource_list, - const fastrtps::rtps::LocatorSelectorEntry& locator_selector_entry) + SendResourceList& sender_resource_list, + const fastrtps::rtps::LocatorSelectorEntry& locator_selector_entry) { static_cast(sender_resource_list); static_cast(locator_selector_entry); From 888378bc0727ff8e82756e0a4fd5cbf2bb26f629 Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Wed, 21 Feb 2024 08:36:41 +0100 Subject: [PATCH 03/11] Refs #20492: Add dll Signed-off-by: Jesus Perez --- include/fastdds/rtps/common/LocatorSelectorEntry.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fastdds/rtps/common/LocatorSelectorEntry.hpp b/include/fastdds/rtps/common/LocatorSelectorEntry.hpp index 0196adf84e4..b4f4bfdb79e 100644 --- a/include/fastdds/rtps/common/LocatorSelectorEntry.hpp +++ b/include/fastdds/rtps/common/LocatorSelectorEntry.hpp @@ -24,6 +24,7 @@ #include #include #include +#include namespace eprosima { namespace fastrtps { @@ -35,7 +36,7 @@ namespace rtps { * This class holds the locators of a remote endpoint along with data required for the locator selection algorithm. * Can be easily integrated inside other classes, such as @ref ReaderProxyData and @ref WriterProxyData. */ -struct LocatorSelectorEntry +struct RTPS_DllAPI LocatorSelectorEntry { /** * Holds the selection state of the locators held by a LocatorSelectorEntry From bde2024879c5fb2cfa4b31686597c6ba385d529c Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Wed, 28 Feb 2024 11:38:40 +0100 Subject: [PATCH 04/11] Refs #20492: Apply suggestions Signed-off-by: Jesus Perez --- .../rtps/transport/TransportInterface.h | 26 ++++++++++++++----- src/cpp/rtps/transport/TransportInterface.cpp | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/fastdds/rtps/transport/TransportInterface.h b/include/fastdds/rtps/transport/TransportInterface.h index 568aead58ab..e7391472469 100644 --- a/include/fastdds/rtps/transport/TransportInterface.h +++ b/include/fastdds/rtps/transport/TransportInterface.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -135,17 +136,30 @@ class RTPS_DllAPI TransportInterface SendResourceList& sender_resource_list, const Locator&) = 0; - //! Must open the channel that maps to/from the given locator selector entry. This method must allocate, - //! reserve and mark any resources that are needed for said channel. + /** + * Must open the channel that maps to/from the given locator selector entry. This method must allocate, + * reserve and mark any resources that are needed for said channel. + * + * @param sender_resource_list Participant's send resource list. + * @param locator_selector_entry Locator selector entry with the remote participant's locators. + * + * @return true if the channel was correctly opened or if finding an already opened one. + */ virtual bool OpenOutputChannel( SendResourceList& sender_resource_list, - const fastrtps::rtps::LocatorSelectorEntry&); - + const fastrtps::rtps::LocatorSelectorEntry& locator_selector_entry); - //! Close the channel that maps to/from the given locator selector entry. + /** + * Close the channel that maps to/from the given locator selector entry. + * + * @param sender_resource_list Participant's send resource list. + * @param locator_selector_entry Locator selector entry with the remote participant's locators. + * + * @return true if the channel was correctly closed or if it was already closed. + */ virtual void CloseOutputChannel( SendResourceList& sender_resource_list, - const fastrtps::rtps::LocatorSelectorEntry&); + const fastrtps::rtps::LocatorSelectorEntry& locator_selector_entry); /** Opens an input channel to receive incoming connections. * If there is an existing channel it registers the receiver interface. diff --git a/src/cpp/rtps/transport/TransportInterface.cpp b/src/cpp/rtps/transport/TransportInterface.cpp index 0a1104bee79..f000e32bce5 100644 --- a/src/cpp/rtps/transport/TransportInterface.cpp +++ b/src/cpp/rtps/transport/TransportInterface.cpp @@ -14,7 +14,7 @@ #include -#include +#include namespace eprosima { From 29f76e08ac9b2acd0c224463b8287f3af98efe45 Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Wed, 28 Feb 2024 11:52:00 +0100 Subject: [PATCH 05/11] Refs #20492: Fix method description Signed-off-by: Jesus Perez --- include/fastdds/rtps/transport/TransportInterface.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/fastdds/rtps/transport/TransportInterface.h b/include/fastdds/rtps/transport/TransportInterface.h index e7391472469..03c7b7a1333 100644 --- a/include/fastdds/rtps/transport/TransportInterface.h +++ b/include/fastdds/rtps/transport/TransportInterface.h @@ -154,8 +154,6 @@ class RTPS_DllAPI TransportInterface * * @param sender_resource_list Participant's send resource list. * @param locator_selector_entry Locator selector entry with the remote participant's locators. - * - * @return true if the channel was correctly closed or if it was already closed. */ virtual void CloseOutputChannel( SendResourceList& sender_resource_list, From 0a8eb8694165fb36574ef919afff77bb01c4dbd1 Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Thu, 29 Feb 2024 12:51:47 +0100 Subject: [PATCH 06/11] Refs #20492: Remove dll Signed-off-by: Jesus Perez --- include/fastdds/rtps/common/LocatorSelectorEntry.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/fastdds/rtps/common/LocatorSelectorEntry.hpp b/include/fastdds/rtps/common/LocatorSelectorEntry.hpp index b4f4bfdb79e..0196adf84e4 100644 --- a/include/fastdds/rtps/common/LocatorSelectorEntry.hpp +++ b/include/fastdds/rtps/common/LocatorSelectorEntry.hpp @@ -24,7 +24,6 @@ #include #include #include -#include namespace eprosima { namespace fastrtps { @@ -36,7 +35,7 @@ namespace rtps { * This class holds the locators of a remote endpoint along with data required for the locator selection algorithm. * Can be easily integrated inside other classes, such as @ref ReaderProxyData and @ref WriterProxyData. */ -struct RTPS_DllAPI LocatorSelectorEntry +struct LocatorSelectorEntry { /** * Holds the selection state of the locators held by a LocatorSelectorEntry From 6736adaca02e42a588d474c19bf2be9dcbd17c13 Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Mon, 4 Mar 2024 08:38:10 +0100 Subject: [PATCH 07/11] Refs #20492: Fix build and add to versions Signed-off-by: Jesus Perez --- test/unittest/rtps/discovery/CMakeLists.txt | 1 + test/unittest/statistics/rtps/CMakeLists.txt | 1 + versions.md | 1 + 3 files changed, 3 insertions(+) diff --git a/test/unittest/rtps/discovery/CMakeLists.txt b/test/unittest/rtps/discovery/CMakeLists.txt index 52fcaf6541a..0b3c3137d15 100644 --- a/test/unittest/rtps/discovery/CMakeLists.txt +++ b/test/unittest/rtps/discovery/CMakeLists.txt @@ -103,6 +103,7 @@ gtest_discover_tests(EdpTests) #PDP TESTS set(TCPTransportInterface_SOURCE + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/messages/RTPSMessageCreator.cpp diff --git a/test/unittest/statistics/rtps/CMakeLists.txt b/test/unittest/statistics/rtps/CMakeLists.txt index 5bbb555cd27..4a997149ec9 100644 --- a/test/unittest/statistics/rtps/CMakeLists.txt +++ b/test/unittest/statistics/rtps/CMakeLists.txt @@ -44,6 +44,7 @@ target_link_libraries(RTPSStatisticsTests fastrtps fastcdr GTest::gtest GTest::g gtest_discover_tests(RTPSStatisticsTests) set(TCPTransportInterface_SOURCE + ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/TransportInterface.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/ChannelResource.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/transport/PortBasedTransportDescriptor.cpp ${PROJECT_SOURCE_DIR}/src/cpp/rtps/messages/RTPSMessageCreator.cpp diff --git a/versions.md b/versions.md index 9dafef49ef3..faf52340f18 100644 --- a/versions.md +++ b/versions.md @@ -3,6 +3,7 @@ Forthcoming Migrate communication tests in `dds/communication` folder * Added authentication handshake properties. +* Added methods OpenOutputChannel and CloseOutputChannel to TransportInterface with LocatorSelectorEntry argument. Version 2.13.0 -------------- From 1e4878471e77996efcf4567bf6a036af6a573654 Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Tue, 5 Mar 2024 12:54:28 +0100 Subject: [PATCH 08/11] Refs #20492: Apply suggestions Signed-off-by: Jesus Perez --- include/fastdds/rtps/transport/TransportInterface.h | 4 ++-- src/cpp/rtps/transport/TransportInterface.cpp | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/fastdds/rtps/transport/TransportInterface.h b/include/fastdds/rtps/transport/TransportInterface.h index 03c7b7a1333..ca547f373fa 100644 --- a/include/fastdds/rtps/transport/TransportInterface.h +++ b/include/fastdds/rtps/transport/TransportInterface.h @@ -141,7 +141,7 @@ class RTPS_DllAPI TransportInterface * reserve and mark any resources that are needed for said channel. * * @param sender_resource_list Participant's send resource list. - * @param locator_selector_entry Locator selector entry with the remote participant's locators. + * @param locator_selector_entry Locator selector entry with the remote entity locators. * * @return true if the channel was correctly opened or if finding an already opened one. */ @@ -153,7 +153,7 @@ class RTPS_DllAPI TransportInterface * Close the channel that maps to/from the given locator selector entry. * * @param sender_resource_list Participant's send resource list. - * @param locator_selector_entry Locator selector entry with the remote participant's locators. + * @param locator_selector_entry Locator selector entry with the remote entity locators. */ virtual void CloseOutputChannel( SendResourceList& sender_resource_list, diff --git a/src/cpp/rtps/transport/TransportInterface.cpp b/src/cpp/rtps/transport/TransportInterface.cpp index f000e32bce5..e535e8de2a0 100644 --- a/src/cpp/rtps/transport/TransportInterface.cpp +++ b/src/cpp/rtps/transport/TransportInterface.cpp @@ -16,7 +16,6 @@ #include - namespace eprosima { namespace fastdds { namespace rtps { From 21d5a23b11018b5f43ba99ff3abc002adc4a78fe Mon Sep 17 00:00:00 2001 From: EduPonz Date: Tue, 5 Mar 2024 15:29:11 +0100 Subject: [PATCH 09/11] Refs #20492: Add TODO in NetworkFactory Signed-off-by: EduPonz --- src/cpp/rtps/network/NetworkFactory.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cpp/rtps/network/NetworkFactory.cpp b/src/cpp/rtps/network/NetworkFactory.cpp index 1773038cfa4..456313d45b8 100644 --- a/src/cpp/rtps/network/NetworkFactory.cpp +++ b/src/cpp/rtps/network/NetworkFactory.cpp @@ -477,6 +477,8 @@ void NetworkFactory::remove_participant_associated_send_resources( const LocatorList_t& remote_participant_locators, const LocatorList_t& participant_initial_peers) const { + // TODO(eduponz): Call the overload of CloseOutputChannel that takes a LocatorSelectorEntry for + // all transports and let them decide what to do. for (auto& transport : mRegisteredTransports) { TCPTransportInterface* tcp_transport = dynamic_cast(transport.get()); From e4e2ca5e14fd96b374ae98419d401c3efdf65516 Mon Sep 17 00:00:00 2001 From: EduPonz Date: Wed, 6 Mar 2024 08:31:14 +0100 Subject: [PATCH 10/11] Refs #20492: Rename TCPTransportInterface::CloseOutputChannel to cleanup_sender_resources Signed-off-by: EduPonz --- src/cpp/rtps/network/NetworkFactory.cpp | 2 +- src/cpp/rtps/transport/TCPTransportInterface.cpp | 2 +- src/cpp/rtps/transport/TCPTransportInterface.h | 2 +- test/unittest/transport/TCPv4Tests.cpp | 6 +++--- test/unittest/transport/TCPv6Tests.cpp | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cpp/rtps/network/NetworkFactory.cpp b/src/cpp/rtps/network/NetworkFactory.cpp index 456313d45b8..61271de95f1 100644 --- a/src/cpp/rtps/network/NetworkFactory.cpp +++ b/src/cpp/rtps/network/NetworkFactory.cpp @@ -484,7 +484,7 @@ void NetworkFactory::remove_participant_associated_send_resources( TCPTransportInterface* tcp_transport = dynamic_cast(transport.get()); if (tcp_transport) { - tcp_transport->CloseOutputChannel( + tcp_transport->cleanup_sender_resources( send_resource_list, remote_participant_locators, participant_initial_peers); diff --git a/src/cpp/rtps/transport/TCPTransportInterface.cpp b/src/cpp/rtps/transport/TCPTransportInterface.cpp index ba7c2c46170..bc82b04f907 100644 --- a/src/cpp/rtps/transport/TCPTransportInterface.cpp +++ b/src/cpp/rtps/transport/TCPTransportInterface.cpp @@ -1888,7 +1888,7 @@ void TCPTransportInterface::fill_local_physical_port( } } -void TCPTransportInterface::CloseOutputChannel( +void TCPTransportInterface::cleanup_sender_resources( SendResourceList& send_resource_list, const LocatorList& remote_participant_locators, const LocatorList& participant_initial_peers) const diff --git a/src/cpp/rtps/transport/TCPTransportInterface.h b/src/cpp/rtps/transport/TCPTransportInterface.h index a796a2b401f..31a5a58cee2 100644 --- a/src/cpp/rtps/transport/TCPTransportInterface.h +++ b/src/cpp/rtps/transport/TCPTransportInterface.h @@ -480,7 +480,7 @@ class TCPTransportInterface : public TransportInterface * @param remote_participant_locators Set of locators associated to the remote participant. * @param participant_initial_peers List of locators associated to the initial peers of the local participant. */ - void CloseOutputChannel( + void cleanup_sender_resources( SendResourceList& send_resource_list, const LocatorList& remote_participant_locators, const LocatorList& participant_initial_peers) const; diff --git a/test/unittest/transport/TCPv4Tests.cpp b/test/unittest/transport/TCPv4Tests.cpp index 83b37f45a57..f0125f170db 100644 --- a/test/unittest/transport/TCPv4Tests.cpp +++ b/test/unittest/transport/TCPv4Tests.cpp @@ -2116,7 +2116,7 @@ TEST_F(TCPv4Tests, remove_from_send_resource_list) IPLocator::setWan(wrong_output_locator, g_test_wan_address); } wrong_remote_participant_physical_locators.push_back(wrong_output_locator); - send_transport_under_test.CloseOutputChannel( + send_transport_under_test.cleanup_sender_resources( send_resource_list, wrong_remote_participant_physical_locators, initial_peer_list); @@ -2125,7 +2125,7 @@ TEST_F(TCPv4Tests, remove_from_send_resource_list) // Using the correct locator should remove the channel resource LocatorList_t remote_participant_physical_locators; remote_participant_physical_locators.push_back(discovery_locator); - send_transport_under_test.CloseOutputChannel( + send_transport_under_test.cleanup_sender_resources( send_resource_list, remote_participant_physical_locators, initial_peer_list); @@ -2140,7 +2140,7 @@ TEST_F(TCPv4Tests, remove_from_send_resource_list) IPLocator::setWan(initial_peer_locator, g_test_wan_address); } remote_participant_physical_locators.push_back(initial_peer_locator); - send_transport_under_test.CloseOutputChannel( + send_transport_under_test.cleanup_sender_resources( send_resource_list, remote_participant_physical_locators, initial_peer_list); diff --git a/test/unittest/transport/TCPv6Tests.cpp b/test/unittest/transport/TCPv6Tests.cpp index 7ac66b84e8c..7486ed20468 100644 --- a/test/unittest/transport/TCPv6Tests.cpp +++ b/test/unittest/transport/TCPv6Tests.cpp @@ -527,7 +527,7 @@ TEST_F(TCPv6Tests, remove_from_send_resource_list) IPLocator::createLocator(LOCATOR_KIND_TCPv6, "::1", g_default_port + 2, wrong_output_locator); IPLocator::setLogicalPort(wrong_output_locator, 7410); wrong_remote_participant_physical_locators.push_back(wrong_output_locator); - send_transport_under_test.CloseOutputChannel( + send_transport_under_test.cleanup_sender_resources( send_resource_list, wrong_remote_participant_physical_locators, initial_peer_list); @@ -536,7 +536,7 @@ TEST_F(TCPv6Tests, remove_from_send_resource_list) // Using the correct locator should remove the channel resource LocatorList_t remote_participant_physical_locators; remote_participant_physical_locators.push_back(output_locator_1); - send_transport_under_test.CloseOutputChannel( + send_transport_under_test.cleanup_sender_resources( send_resource_list, remote_participant_physical_locators, initial_peer_list); @@ -545,7 +545,7 @@ TEST_F(TCPv6Tests, remove_from_send_resource_list) // Using the initial peer locator should not remove the channel resource remote_participant_physical_locators.clear(); remote_participant_physical_locators.push_back(output_locator_2); - send_transport_under_test.CloseOutputChannel( + send_transport_under_test.cleanup_sender_resources( send_resource_list, remote_participant_physical_locators, initial_peer_list); From 42edc5ea3d4284ed39cb21e9be20028e682af6c7 Mon Sep 17 00:00:00 2001 From: EduPonz Date: Wed, 6 Mar 2024 09:47:36 +0100 Subject: [PATCH 11/11] Refs #20492: Rename new TransportInterface::Open|CloseOutputChannel to Open|CloseOutputChannels Signed-off-by: EduPonz --- include/fastdds/rtps/transport/TransportInterface.h | 4 ++-- src/cpp/rtps/transport/TransportInterface.cpp | 4 ++-- versions.md | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/fastdds/rtps/transport/TransportInterface.h b/include/fastdds/rtps/transport/TransportInterface.h index ca547f373fa..517ac9c46fc 100644 --- a/include/fastdds/rtps/transport/TransportInterface.h +++ b/include/fastdds/rtps/transport/TransportInterface.h @@ -145,7 +145,7 @@ class RTPS_DllAPI TransportInterface * * @return true if the channel was correctly opened or if finding an already opened one. */ - virtual bool OpenOutputChannel( + virtual bool OpenOutputChannels( SendResourceList& sender_resource_list, const fastrtps::rtps::LocatorSelectorEntry& locator_selector_entry); @@ -155,7 +155,7 @@ class RTPS_DllAPI TransportInterface * @param sender_resource_list Participant's send resource list. * @param locator_selector_entry Locator selector entry with the remote entity locators. */ - virtual void CloseOutputChannel( + virtual void CloseOutputChannels( SendResourceList& sender_resource_list, const fastrtps::rtps::LocatorSelectorEntry& locator_selector_entry); diff --git a/src/cpp/rtps/transport/TransportInterface.cpp b/src/cpp/rtps/transport/TransportInterface.cpp index e535e8de2a0..a108682a999 100644 --- a/src/cpp/rtps/transport/TransportInterface.cpp +++ b/src/cpp/rtps/transport/TransportInterface.cpp @@ -22,7 +22,7 @@ namespace rtps { using LocatorSelectorEntry = fastrtps::rtps::LocatorSelectorEntry; -bool TransportInterface::OpenOutputChannel( +bool TransportInterface::OpenOutputChannels( SendResourceList& send_resource_list, const LocatorSelectorEntry& locator_selector_entry) { @@ -40,7 +40,7 @@ bool TransportInterface::OpenOutputChannel( return success; } -void TransportInterface::CloseOutputChannel( +void TransportInterface::CloseOutputChannels( SendResourceList& sender_resource_list, const fastrtps::rtps::LocatorSelectorEntry& locator_selector_entry) { diff --git a/versions.md b/versions.md index faf52340f18..f14306e3473 100644 --- a/versions.md +++ b/versions.md @@ -3,7 +3,7 @@ Forthcoming Migrate communication tests in `dds/communication` folder * Added authentication handshake properties. -* Added methods OpenOutputChannel and CloseOutputChannel to TransportInterface with LocatorSelectorEntry argument. +* Added methods OpenOutputChannels and CloseOutputChannels to TransportInterface with LocatorSelectorEntry argument. Version 2.13.0 --------------