From 5ee539326176aa33072efbf9d56f0c49ee74c929 Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Fri, 15 Mar 2024 09:13:11 +0100 Subject: [PATCH] Refs #20508: Solve conflicts Signed-off-by: Jesus Perez --- .../rtps/transport/TCPTransportDescriptor.h | 11 - resources/xsd/fastRTPS_profiles.xsd | 37 +- .../rtps/transport/TCPTransportInterface.cpp | 64 --- .../rtps/transport/TCPTransportInterface.h | 16 - .../common/BlackboxTestsTransportTCP.cpp | 380 ------------------ .../XMLTesterExample_profile.xml | 4 - .../tools/xmlvalidation/all_profile.xml | 4 - test/unittest/transport/TCPv6Tests.cpp | 213 +++------- test/unittest/xmlparser/XMLParserTests.cpp | 10 - 9 files changed, 56 insertions(+), 683 deletions(-) diff --git a/include/fastdds/rtps/transport/TCPTransportDescriptor.h b/include/fastdds/rtps/transport/TCPTransportDescriptor.h index f91f5a797ff..f002ac4bad0 100644 --- a/include/fastdds/rtps/transport/TCPTransportDescriptor.h +++ b/include/fastdds/rtps/transport/TCPTransportDescriptor.h @@ -53,15 +53,8 @@ namespace rtps { * * - \c tls_config: Configuration for TLS. * -<<<<<<< HEAD -======= - * - \c non_blocking_send: do not block on send operations. When it is set to true, send operations will return - * immediately if the buffer might get full, but no error will be returned to the upper layer. This means - * that the application will behave as if the datagram is sent and lost. - * * - \c tcp_negotiation_timeout: time to wait for logical port negotiation (in ms). * ->>>>>>> 8103cf042 (TCP first message loss (#4454)) * @ingroup TRANSPORT_MODULE */ struct TCPTransportDescriptor : public SocketTransportDescriptor @@ -260,15 +253,11 @@ struct TCPTransportDescriptor : public SocketTransportDescriptor //! Increment between logical ports to try during RTCP negotiation uint16_t logical_port_increment; -<<<<<<< HEAD - FASTDDS_TODO_BEFORE(3, 0, "Eliminate tcp_negotiation_timeout, variable not in use.") -======= /** * Time to wait for logical port negotiation (ms). If a logical port is under negotiation, it waits for the * negotiation to finish up to this timeout before trying to send a message to that port. * Zero value means no waiting (default). */ ->>>>>>> 8103cf042 (TCP first message loss (#4454)) uint32_t tcp_negotiation_timeout; //! Enables the TCP_NODELAY socket option diff --git a/resources/xsd/fastRTPS_profiles.xsd b/resources/xsd/fastRTPS_profiles.xsd index f7f519b4ff1..9b9e596b788 100644 --- a/resources/xsd/fastRTPS_profiles.xsd +++ b/resources/xsd/fastRTPS_profiles.xsd @@ -844,40 +844,6 @@ -======= ├ transport_id [string], ├ type [string] ("UDPv4", "UDPv6", "TCPv4", "TCPv6", "SHM"), ├ sendBufferSize [uint32], @@ -887,7 +853,7 @@ ├ interfaceWhiteList [0~*], (NOT available for SHM type) | └ address [ipv4Address|ipv6Address] ├ TTL [uint8], (ONLY available for UDP type) - ├ non_blocking_send [boolean], (NOT available for SHM type) + ├ non_blocking_send [boolean], (ONLY available for UDP type) ├ output_port [uint16], (ONLY available for UDP type) ├ wan_addr [ipv4AddressFormat], (ONLY available for TCPv4 type) ├ keep_alive_frequency_ms [uint32], (ONLY available for TCP type) @@ -911,7 +877,6 @@ ├ default_reception_threads [threadSettingsType] ├ reception_threads [receptionThreadsListType] (ONLY available for SHM type) └ dump_thread [threadSettingsType] (ONLY available for SHM type) --> ->>>>>>> 8103cf042 (TCP first message loss (#4454)) diff --git a/src/cpp/rtps/transport/TCPTransportInterface.cpp b/src/cpp/rtps/transport/TCPTransportInterface.cpp index 04d3293ba8c..cfe4e16283a 100644 --- a/src/cpp/rtps/transport/TCPTransportInterface.cpp +++ b/src/cpp/rtps/transport/TCPTransportInterface.cpp @@ -87,13 +87,6 @@ static const int s_default_keep_alive_frequency = 5000; // 5 SECONDS static const int s_default_keep_alive_timeout = 15000; // 15 SECONDS //static const int s_clean_deleted_sockets_pool_timeout = 100; // 100 MILLISECONDS -<<<<<<< HEAD -FASTDDS_TODO_BEFORE(3, 0, - "Eliminate s_default_tcp_negotitation_timeout, variable used to initialize deprecate attribute.") -static const int s_default_tcp_negotitation_timeout = 5000; // 5 Seconds - -======= ->>>>>>> 8103cf042 (TCP first message loss (#4454)) TCPTransportDescriptor::TCPTransportDescriptor() : SocketTransportDescriptor(s_maximumMessageSize, s_maximumInitialPeersRange) , keep_alive_frequency_ms(s_default_keep_alive_frequency) @@ -1878,62 +1871,6 @@ void TCPTransportInterface::fill_local_physical_port( } } -<<<<<<< HEAD -======= -void TCPTransportInterface::CloseOutputChannel( - SendResourceList& send_resource_list, - const LocatorList& remote_participant_locators, - const LocatorList& participant_initial_peers) const -{ - // Since send resources handle physical locators, we need to convert the remote participant locators to physical - std::set remote_participant_physical_locators; - for (const Locator& remote_participant_locator : remote_participant_locators) - { - remote_participant_physical_locators.insert(IPLocator::toPhysicalLocator(remote_participant_locator)); - - // Also add the WANtoLANLocator ([0][WAN] address) if the remote locator is a WAN locator. In WAN scenario, - //initial peer can also work with the WANtoLANLocator of the remote participant. - if (IPLocator::hasWan(remote_participant_locator)) - { - remote_participant_physical_locators.insert(IPLocator::toPhysicalLocator(IPLocator::WanToLanLocator( - remote_participant_locator))); - } - } - - // Exlude initial peers. - for (const auto& initial_peer : participant_initial_peers) - { - if (std::find(remote_participant_physical_locators.begin(), remote_participant_physical_locators.end(), - IPLocator::toPhysicalLocator(initial_peer)) != remote_participant_physical_locators.end()) - { - remote_participant_physical_locators.erase(IPLocator::toPhysicalLocator(initial_peer)); - } - } - - for (const auto& remote_participant_physical_locator : remote_participant_physical_locators) - { - if (!IsLocatorSupported(remote_participant_physical_locator)) - { - continue; - } - // Remove send resources for the associated remote participant locator - for (auto it = send_resource_list.begin(); it != send_resource_list.end();) - { - TCPSenderResource* tcp_sender_resource = TCPSenderResource::cast(*this, it->get()); - - if (tcp_sender_resource) - { - if (tcp_sender_resource->locator() == remote_participant_physical_locator) - { - it = send_resource_list.erase(it); - continue; - } - } - ++it; - } - } -} - void TCPTransportInterface::send_channel_pending_logical_ports( std::shared_ptr& channel) { @@ -1949,7 +1886,6 @@ void TCPTransportInterface::send_channel_pending_logical_ports( } } ->>>>>>> 8103cf042 (TCP first message loss (#4454)) } // namespace rtps } // namespace fastrtps } // namespace eprosima diff --git a/src/cpp/rtps/transport/TCPTransportInterface.h b/src/cpp/rtps/transport/TCPTransportInterface.h index 495a04af8b4..ca534dfd654 100644 --- a/src/cpp/rtps/transport/TCPTransportInterface.h +++ b/src/cpp/rtps/transport/TCPTransportInterface.h @@ -479,26 +479,11 @@ class TCPTransportInterface : public TransportInterface void fill_local_physical_port( Locator& locator) const; -<<<<<<< HEAD bool get_non_blocking_send() const { return non_blocking_send_; } -======= - /** - * Close the output channel associated to the given remote participant but if its locators belong to the - * given list of initial peers. - * - * @param send_resource_list List of send resources associated to the local participant. - * @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( - SendResourceList& send_resource_list, - const LocatorList& remote_participant_locators, - const LocatorList& participant_initial_peers) const; - /** * Method to add the logical ports associated to a channel that was not available * when the logical ports were obtained. @@ -506,7 +491,6 @@ class TCPTransportInterface : public TransportInterface */ void send_channel_pending_logical_ports( std::shared_ptr& channel); ->>>>>>> 8103cf042 (TCP first message loss (#4454)) }; } // namespace rtps diff --git a/test/blackbox/common/BlackboxTestsTransportTCP.cpp b/test/blackbox/common/BlackboxTestsTransportTCP.cpp index c1582b32996..edb73b7962f 100644 --- a/test/blackbox/common/BlackboxTestsTransportTCP.cpp +++ b/test/blackbox/common/BlackboxTestsTransportTCP.cpp @@ -842,385 +842,6 @@ TEST_P(TransportTCP, large_data_topology) writers.clear(); } -<<<<<<< HEAD -======= -// This test verifies that if having a server with several listening ports, only the first one is used. -TEST_P(TransportTCP, multiple_listening_ports) -{ - // Create a server with several listening ports - PubSubReader* server = new PubSubReader(TEST_TOPIC_NAME); - uint16_t server_port_1 = 10000; - uint16_t server_port_2 = 10001; - - std::shared_ptr server_transport; - if (use_ipv6) - { - server_transport = std::make_shared(); - } - else - { - server_transport = std::make_shared(); - } - server_transport->add_listener_port(server_port_1); - server_transport->add_listener_port(server_port_2); - server->disable_builtin_transport().add_user_transport_to_pparams(server_transport).init(); - ASSERT_TRUE(server->isInitialized()); - - // Create two clients each one connecting to a different port - PubSubWriter* client_1 = new PubSubWriter(TEST_TOPIC_NAME); - PubSubWriter* client_2 = new PubSubWriter(TEST_TOPIC_NAME); - std::shared_ptr client_transport_1; - std::shared_ptr client_transport_2; - Locator_t initialPeerLocator_1; - Locator_t initialPeerLocator_2; - if (use_ipv6) - { - client_transport_1 = std::make_shared(); - client_transport_2 = std::make_shared(); - initialPeerLocator_1.kind = LOCATOR_KIND_TCPv6; - initialPeerLocator_2.kind = LOCATOR_KIND_TCPv6; - IPLocator::setIPv6(initialPeerLocator_1, "::1"); - IPLocator::setIPv6(initialPeerLocator_2, "::1"); - } - else - { - client_transport_1 = std::make_shared(); - client_transport_2 = std::make_shared(); - initialPeerLocator_1.kind = LOCATOR_KIND_TCPv4; - initialPeerLocator_2.kind = LOCATOR_KIND_TCPv4; - IPLocator::setIPv4(initialPeerLocator_1, 127, 0, 0, 1); - IPLocator::setIPv4(initialPeerLocator_2, 127, 0, 0, 1); - } - client_1->disable_builtin_transport().add_user_transport_to_pparams(client_transport_1); - client_2->disable_builtin_transport().add_user_transport_to_pparams(client_transport_2); - initialPeerLocator_1.port = server_port_1; - initialPeerLocator_2.port = server_port_2; - LocatorList_t initial_peer_list_1; - LocatorList_t initial_peer_list_2; - initial_peer_list_1.push_back(initialPeerLocator_1); - initial_peer_list_2.push_back(initialPeerLocator_2); - client_1->initial_peers(initial_peer_list_1); - client_2->initial_peers(initial_peer_list_2); - client_1->init(); - client_2->init(); - ASSERT_TRUE(client_1->isInitialized()); - ASSERT_TRUE(client_2->isInitialized()); - - // Wait for discovery. - server->wait_discovery(); - client_1->wait_discovery(); - client_2->wait_discovery(std::chrono::seconds(1)); - EXPECT_EQ(server->get_matched(), 1U); - EXPECT_EQ(client_1->get_matched(), 1U); - EXPECT_EQ(client_2->get_matched(), 0U); - - // Send data - auto data = default_helloworld_data_generator(); - server->startReception(data); - client_1->send(data); - // In this test all data should be sent. - ASSERT_TRUE(data.empty()); - // Block server until reception finished. - server->block_for_all(); - // Wait for all data to be acked. - EXPECT_TRUE(client_1->waitForAllAcked(std::chrono::milliseconds(100))); - - // Release TCP client and server resources. - delete client_1; - delete client_2; - delete server; -} - -// Test TCP send resource cleaning. This test matches a server with a client and then releases the -// client resources. After PDP unbind message, the server removes the client -// from the send resource list. -TEST_P(TransportTCP, send_resource_cleanup) -{ - eprosima::fastdds::dds::Log::SetVerbosity(eprosima::fastdds::dds::Log::Warning); - - using eprosima::fastdds::rtps::DatagramInjectionTransportDescriptor; - - std::unique_ptr> client(new PubSubWriter(TEST_TOPIC_NAME)); - std::unique_ptr> udp_participant(new PubSubWriter( - TEST_TOPIC_NAME)); - std::unique_ptr> server(new PubSubReader(TEST_TOPIC_NAME)); - - // Server - // Create a server with two transports, one of which uses a DatagramInjectionTransportDescriptor - // which heritates from ChainingTransportDescriptor. The low level transport of this chaining transport will be UDP. - // This will allow us to get send_resource_list_ from the server participant when UDP transport gets its OpenOutputChannel() - // method called. This should happen after TCP transports connection is established. We can then see how many TCP send - // resources exist. - // For the cleanup test we follow that same procedure. Firstly we destroy both participants and then instantiate a new - // UDP participant. The send resource list will get updated with no TCP send resource. - // __________________________________________________________ _____________________ - // | Server | | Client | - // | | | | - // | SendResourceList | | | - // | | | | | - // | Empty | | | - // | | | | | - // | | - TCPv4 init() | | | - // | | | | | - // | | - ChainingTransport(UDP) init() | | | - // | | | | | - // | 1 TCP <------------------------------------------------- TCPv4 init() | - // | | | | | - // | 1 TCP + 1 UDP <------------------------------------------------- UDPv4 init() | - // | | | | | - // | | - ChainingTransport-> | | | - // | TCP SendResources == 1 get_send_resource_list() | | | - // | | | | | - // | Empty <-------------------------------------------------- clean transports | - // | | | | | - // | 1 UDP - ChainingTransport(UDP) <------------------------ UDPv4 init() | - // | | | | | - // | | - ChainingTransport-> | | | - // | TCP SendResources == 0 get_send_resource_list() | | | - // |__________________________________________________________| |_____________________| - // - uint16_t server_port = 10000; - test_transport_->add_listener_port(server_port); - auto low_level_transport = std::make_shared(); - auto server_chaining_transport = std::make_shared(low_level_transport); - server->disable_builtin_transport().add_user_transport_to_pparams(test_transport_).add_user_transport_to_pparams( - server_chaining_transport).init(); - ASSERT_TRUE(server->isInitialized()); - - // Client - auto initialize_client = [&](PubSubWriter* client) - { - std::shared_ptr client_transport; - Locator_t initialPeerLocator; - if (use_ipv6) - { - client_transport = std::make_shared(); - initialPeerLocator.kind = LOCATOR_KIND_TCPv6; - IPLocator::setIPv6(initialPeerLocator, "::1"); - } - else - { - client_transport = std::make_shared(); - initialPeerLocator.kind = LOCATOR_KIND_TCPv4; - IPLocator::setIPv4(initialPeerLocator, 127, 0, 0, 1); - } - client->disable_builtin_transport().add_user_transport_to_pparams(client_transport); - initialPeerLocator.port = server_port; - LocatorList_t initial_peer_list; - initial_peer_list.push_back(initialPeerLocator); - client->initial_peers(initial_peer_list); - client->init(); - }; - auto initialize_udp_participant = [&](PubSubWriter* udp_participant) - { - auto udp_participant_transport = std::make_shared(); - udp_participant->disable_builtin_transport().add_user_transport_to_pparams(udp_participant_transport); - udp_participant->init(); - }; - initialize_client(client.get()); - ASSERT_TRUE(client->isInitialized()); - - // Wait for discovery. OpenOutputChannel() is called. We create a udp participant after to guarantee - // that the TCP participants have been mutually discovered when OpenOutputChannel() is called. - server->wait_discovery(std::chrono::seconds(0), 1); - client->wait_discovery(1, std::chrono::seconds(0)); - - initialize_udp_participant(udp_participant.get()); - ASSERT_TRUE(udp_participant->isInitialized()); - server->wait_discovery(std::chrono::seconds(0), 2); - udp_participant->wait_discovery(1, std::chrono::seconds(0)); - - // We can only update the senders when OpenOutputChannel() is called. If the send resource - // is deleted later, senders obtained from get_send_resource_list() won't have changed. - auto send_resource_list = server_chaining_transport->get_send_resource_list(); - auto tcp_send_resources = [](const std::set& send_resource_list) -> size_t - { - size_t tcp_send_resources = 0; - for (auto& sender_resource : send_resource_list) - { - if (sender_resource->kind() == LOCATOR_KIND_TCPv4 || sender_resource->kind() == LOCATOR_KIND_TCPv6) - { - tcp_send_resources++; - } - } - return tcp_send_resources; - }; - EXPECT_EQ(tcp_send_resources(send_resource_list), 1); - - // Release TCP client resources. - client.reset(); - udp_participant.reset(); - - // Wait for undiscovery. - server->wait_writer_undiscovery(); - - // Create new udp client. - udp_participant.reset(new PubSubWriter(TEST_TOPIC_NAME)); - - // Wait for discovery. OpenOutputChannel() is called and we can update the senders. - initialize_udp_participant(udp_participant.get()); - ASSERT_TRUE(udp_participant->isInitialized()); - server->wait_discovery(std::chrono::seconds(0), 1); - udp_participant->wait_discovery(1, std::chrono::seconds(0)); - - // Check that the send_resource_list has size 0. This means that the send resource - // for the client has been removed. - send_resource_list = server_chaining_transport->get_send_resource_list(); - EXPECT_EQ(tcp_send_resources(send_resource_list), 0); - send_resource_list.clear(); -} - -// Test TCP send resource cleaning. In this case, since the send resource has been created from an initial_peer, -// the send resource should not be removed. -TEST_P(TransportTCP, send_resource_cleanup_initial_peer) -{ - eprosima::fastdds::dds::Log::SetVerbosity(eprosima::fastdds::dds::Log::Warning); - - using eprosima::fastdds::rtps::DatagramInjectionTransportDescriptor; - - std::unique_ptr> client(new PubSubWriter(TEST_TOPIC_NAME)); - std::unique_ptr> udp_participant(new PubSubReader( - TEST_TOPIC_NAME)); - std::unique_ptr> server(new PubSubReader(TEST_TOPIC_NAME)); - - // Client - // Create a client with two transports, one of which uses a DatagramInjectionTransportDescriptor - // which heritates from ChainingTransportDescriptor. This will allow us to get send_resource_list_ - // from the client participant when its transport gets its OpenOutputChannel() method called. - - // __________________________________________________________ _____________________ - // | Server | | Client | - // | | | | - // | SendResourceList | | | - // | | | | | - // | Empty | | | - // | | | | | - // | | - TCPv4 init() | | | - // | | | | | - // | | - ChainingTransport(UDP) init() | | | - // | | | | | - // | 1 TCP <------------------------------------------------- TCPv4 init() | - // | | | | | - // | 1 TCP + 1 UDP <------------------------------------------------- UDPv4 init() | - // | | | | | - // | | - ChainingTransport-> | | | - // | TCP SendResources == 1 get_send_resource_list() | | | - // | | | | | - // | 1 TCP (initial peer) <-------------------------------------------------- clean transports | - // | | | | | - // | 1 TCP + 1 UDP - ChainingTransport(UDP) <------------------------ UDPv4 init() | - // | | | | | - // | | - ChainingTransport-> | | | - // | TCP SendResources == 1 get_send_resource_list() | | | - // | (initial peer) | | | - // |__________________________________________________________| |_____________________| - // - - uint16_t server_port = 10000; - LocatorList_t initial_peer_list; - Locator_t initialPeerLocator; - if (use_ipv6) - { - initialPeerLocator.kind = LOCATOR_KIND_TCPv6; - IPLocator::setIPv6(initialPeerLocator, "::1"); - } - else - { - initialPeerLocator.kind = LOCATOR_KIND_TCPv4; - IPLocator::setIPv4(initialPeerLocator, 127, 0, 0, 1); - } - initialPeerLocator.port = server_port; - initial_peer_list.push_back(initialPeerLocator); - client->initial_peers(initial_peer_list); - - auto low_level_transport = std::make_shared(); - auto client_chaining_transport = std::make_shared(low_level_transport); - client->disable_builtin_transport().add_user_transport_to_pparams(test_transport_).add_user_transport_to_pparams( - client_chaining_transport).init(); - ASSERT_TRUE(client->isInitialized()); - - // Server - auto initialize_server = [&](PubSubReader* server) - { - std::shared_ptr server_transport; - if (use_ipv6) - { - server_transport = std::make_shared(); - } - else - { - server_transport = std::make_shared(); - } - server_transport->add_listener_port(server_port); - server->disable_builtin_transport().add_user_transport_to_pparams(server_transport); - server->init(); - }; - auto initialize_udp_participant = [&](PubSubReader* udp_participant) - { - auto udp_participant_transport = std::make_shared(); - udp_participant->disable_builtin_transport().add_user_transport_to_pparams(udp_participant_transport); - udp_participant->init(); - }; - initialize_server(server.get()); - ASSERT_TRUE(server->isInitialized()); - - // Wait for discovery. OpenOutputChannel() is called. We create a udp participant after to guarantee - // that the TCP participants have been mutually discovered when OpenOutputChannel() is called. - client->wait_discovery(1, std::chrono::seconds(0)); - server->wait_discovery(std::chrono::seconds(0), 1); - - initialize_udp_participant(udp_participant.get()); - ASSERT_TRUE(udp_participant->isInitialized()); - client->wait_discovery(2, std::chrono::seconds(0)); - udp_participant->wait_discovery(std::chrono::seconds(0), 1); - - // We can only update the senders when OpenOutputChannel() is called. If the send resource - // is deleted later, senders obtained from get_send_resource_list() won't have changed. - auto send_resource_list = client_chaining_transport->get_send_resource_list(); - auto tcp_send_resources = [](const std::set& send_resource_list) -> size_t - { - size_t tcp_send_resources = 0; - for (auto& sender_resource : send_resource_list) - { - if (sender_resource->kind() == LOCATOR_KIND_TCPv4 || sender_resource->kind() == LOCATOR_KIND_TCPv6) - { - tcp_send_resources++; - } - } - return tcp_send_resources; - }; - EXPECT_EQ(tcp_send_resources(send_resource_list), 1); - - // Release TCP client resources. - server.reset(); - udp_participant.reset(); - - // Wait for undiscovery. - client->wait_reader_undiscovery(); - - // Create new client instances. - udp_participant.reset(new PubSubReader(TEST_TOPIC_NAME)); - - // Wait for discovery. OpenOutputChannel() is called and we can update the senders. - initialize_udp_participant(udp_participant.get()); - ASSERT_TRUE(udp_participant->isInitialized()); - client->wait_discovery(1, std::chrono::seconds(0)); - udp_participant->wait_discovery(std::chrono::seconds(0), 1); - - // Check that the send_resource_list has size 1. This means that the send resource - // for the first client hasn't been removed because it was created from an initial_peer. - send_resource_list = client_chaining_transport->get_send_resource_list(); - EXPECT_EQ(tcp_send_resources(send_resource_list), 1); - send_resource_list.clear(); - - // If relaunching the server, the client should connect again. - server.reset(new PubSubReader(TEST_TOPIC_NAME)); - initialize_server(server.get()); - ASSERT_TRUE(server->isInitialized()); - server->wait_discovery(std::chrono::seconds(0), 1); - client->wait_discovery(2, std::chrono::seconds(0)); -} - // Test TCP transport on large message with best effort reliability TEST_P(TransportTCP, large_message_send_receive) { @@ -1326,7 +947,6 @@ TEST_P(TransportTCP, large_message_large_data_send_receive) reader.block_for_all(); } ->>>>>>> 8103cf042 (TCP first message loss (#4454)) #ifdef INSTANTIATE_TEST_SUITE_P #define GTEST_INSTANTIATE_TEST_MACRO(x, y, z, w) INSTANTIATE_TEST_SUITE_P(x, y, z, w) #else diff --git a/test/system/tools/xmlvalidation/XMLTesterExample_profile.xml b/test/system/tools/xmlvalidation/XMLTesterExample_profile.xml index 5ecbedf3414..608dc76b7c4 100644 --- a/test/system/tools/xmlvalidation/XMLTesterExample_profile.xml +++ b/test/system/tools/xmlvalidation/XMLTesterExample_profile.xml @@ -51,11 +51,7 @@ false false false -<<<<<<< HEAD -======= - false 100 ->>>>>>> 8103cf042 (TCP first message loss (#4454)) diff --git a/test/system/tools/xmlvalidation/all_profile.xml b/test/system/tools/xmlvalidation/all_profile.xml index 0cd49dce255..9943e52ccd2 100644 --- a/test/system/tools/xmlvalidation/all_profile.xml +++ b/test/system/tools/xmlvalidation/all_profile.xml @@ -893,11 +893,7 @@ false false false -<<<<<<< HEAD -======= - false 100 ->>>>>>> 8103cf042 (TCP first message loss (#4454)) diff --git a/test/unittest/transport/TCPv6Tests.cpp b/test/unittest/transport/TCPv6Tests.cpp index dd6a551ab98..a5bdfb375a1 100644 --- a/test/unittest/transport/TCPv6Tests.cpp +++ b/test/unittest/transport/TCPv6Tests.cpp @@ -513,74 +513,6 @@ TEST_F(TCPv6Tests, opening_output_channel_with_same_locator_as_local_listening_p ASSERT_EQ(send_resource_list.size(), 2); } -/* - TEST_F(TCPv6Tests, send_and_receive_between_both_secure_ports) - { - eprosima::fastdds::dds::Log::SetVerbosity(eprosima::fastdds::dds::Log::Kind::Info); - - using TLSOptions = TCPTransportDescriptor::TLSConfig::TLSOptions; - using TLSVerifyMode = TCPTransportDescriptor::TLSConfig::TLSVerifyMode; - - TCPv6TransportDescriptor recvDescriptor; - recvDescriptor.add_listener_port(g_default_port); - recvDescriptor.apply_security = true; - recvDescriptor.tls_config.password = "testkey"; - recvDescriptor.tls_config.cert_chain_file = "mainpubcert.pem"; - recvDescriptor.tls_config.private_key_file = "mainpubkey.pem"; - recvDescriptor.tls_config.verify_file = "maincacert.pem"; - // Server doesn't accept clients without certs - recvDescriptor.tls_config.verify_mode = TLSVerifyMode::VERIFY_PEER | TLSVerifyMode::VERIFY_FAIL_IF_NO_PEER_CERT; - recvDescriptor.tls_config.add_option(TLSOptions::DEFAULT_WORKAROUNDS); - recvDescriptor.tls_config.add_option(TLSOptions::SINGLE_DH_USE); - recvDescriptor.tls_config.add_option(TLSOptions::NO_COMPRESSION); - recvDescriptor.tls_config.add_option(TLSOptions::NO_SSLV2); - recvDescriptor.tls_config.add_option(TLSOptions::NO_SSLV3); - TCPv6Transport receiveTransportUnderTest(recvDescriptor); - receiveTransportUnderTest.init(); - - TCPv6TransportDescriptor sendDescriptor; - sendDescriptor.apply_security = true; - sendDescriptor.tls_config.password = "testkey"; - sendDescriptor.tls_config.cert_chain_file = "mainsubcert.pem"; - sendDescriptor.tls_config.private_key_file = "mainsubkey.pem"; - sendDescriptor.tls_config.verify_file = "maincacert.pem"; - sendDescriptor.tls_config.verify_mode = TLSVerifyMode::VERIFY_PEER; - sendDescriptor.tls_config.add_option(TLSOptions::DEFAULT_WORKAROUNDS); - sendDescriptor.tls_config.add_option(TLSOptions::SINGLE_DH_USE); - sendDescriptor.tls_config.add_option(TLSOptions::NO_COMPRESSION); - sendDescriptor.tls_config.add_option(TLSOptions::NO_SSLV2); - sendDescriptor.tls_config.add_option(TLSOptions::NO_SSLV3); - TCPv6Transport sendTransportUnderTest(sendDescriptor); - sendTransportUnderTest.init(); - - Locator_t inputLocator; - inputLocator.kind = LOCATOR_KIND_TCPv6; - inputLocator.port = g_default_port; - IPLocator::setIPv4(inputLocator, "::1"); - IPLocator::setLogicalPort(inputLocator, 7410); - - Locator_t outputLocator; - outputLocator.kind = LOCATOR_KIND_TCPv6; - IPLocator::setIPv4(outputLocator, "::1"); - outputLocator.port = g_default_port; - IPLocator::setLogicalPort(outputLocator, 7410); - - { - MockReceiverResource receiver(receiveTransportUnderTest, inputLocator); - MockMessageReceiver *msg_recv = dynamic_cast(receiver.CreateMessageReceiver()); - ASSERT_TRUE(receiveTransportUnderTest.IsInputChannelOpen(inputLocator)); - - ASSERT_TRUE(sendTransportUnderTest.OpenOutputChannel(outputLocator)); - octet message[5] = { 'H','e','l','l','o' }; - -<<<<<<< HEAD - Semaphore sem; - std::function recCallback = [&]() - { - EXPECT_EQ(memcmp(message, msg_recv->data, 5), 0); - sem.post(); - }; -======= // This test verifies the logical port passed to OpenOutputChannel is correctly added to the channel pending list or the // trasnport's pending channel logical ports map. TEST_F(TCPv6Tests, add_logical_port_on_send_resource_creation) @@ -680,107 +612,72 @@ TEST_F(TCPv6Tests, add_logical_port_on_send_resource_creation) } } -// TODO: TEST_F(TCPv6Tests, send_and_receive_between_both_secure_ports) -// TODO: TEST_F(TCPv6Tests, send_and_receive_between_ports) ->>>>>>> 8103cf042 (TCP first message loss (#4454)) - - msg_recv->setCallback(recCallback); - - auto sendThreadFunction = [&]() - { - bool sent = sendTransportUnderTest.send(message, 5, outputLocator, inputLocator); - while (!sent) - { - sent = sendTransportUnderTest.send(message, 5, outputLocator, inputLocator); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - EXPECT_TRUE(sent); - //EXPECT_TRUE(transportUnderTest.send(message, 5, outputLocator, inputLocator)); - }; - - senderThread.reset(new std::thread(sendThreadFunction)); - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - senderThread->join(); - sem.wait(); - } - ASSERT_TRUE(sendTransportUnderTest.CloseOutputChannel(outputLocator)); - } - */ -// TODO SKIP AT THIS MOMENT /* - TEST_F(TCPv6Tests, send_and_receive_between_ports) + TEST_F(TCPv6Tests, send_and_receive_between_both_secure_ports) { - descriptor.listening_ports.push_back(g_default_port); - TCPv6Transport transportUnderTest(descriptor); - transportUnderTest.init(); - - Locator_t localLocator; - localLocator.port = g_default_port; - localLocator.kind = LOCATOR_KIND_TCPv6; - IPLocator::setIPv6(localLocator, "::1"); - - Locator_t outputChannelLocator; - outputChannelLocator = g_default_port; - outputChannelLocator.kind = LOCATOR_KIND_TCPv6; - IPLocator::setIPv6(outputChannelLocator, "::1"); + eprosima::fastdds::dds::Log::SetVerbosity(eprosima::fastdds::dds::Log::Kind::Info); - MockReceiverResource receiver(transportUnderTest, localLocator); - MockMessageReceiver *msg_recv = dynamic_cast(receiver.CreateMessageReceiver()); + using TLSOptions = TCPTransportDescriptor::TLSConfig::TLSOptions; + using TLSVerifyMode = TCPTransportDescriptor::TLSConfig::TLSVerifyMode; - ASSERT_TRUE(transportUnderTest.OpenOutputChannel(outputChannelLocator)); // Includes loopback - ASSERT_TRUE(transportUnderTest.IsInputChannelOpen(localLocator)); - octet message[5] = { 'H','e','l','l','o' }; + TCPv6TransportDescriptor recvDescriptor; + recvDescriptor.add_listener_port(g_default_port); + recvDescriptor.apply_security = true; + recvDescriptor.tls_config.password = "testkey"; + recvDescriptor.tls_config.cert_chain_file = "mainpubcert.pem"; + recvDescriptor.tls_config.private_key_file = "mainpubkey.pem"; + recvDescriptor.tls_config.verify_file = "maincacert.pem"; + // Server doesn't accept clients without certs + recvDescriptor.tls_config.verify_mode = TLSVerifyMode::VERIFY_PEER | TLSVerifyMode::VERIFY_FAIL_IF_NO_PEER_CERT; + recvDescriptor.tls_config.add_option(TLSOptions::DEFAULT_WORKAROUNDS); + recvDescriptor.tls_config.add_option(TLSOptions::SINGLE_DH_USE); + recvDescriptor.tls_config.add_option(TLSOptions::NO_COMPRESSION); + recvDescriptor.tls_config.add_option(TLSOptions::NO_SSLV2); + recvDescriptor.tls_config.add_option(TLSOptions::NO_SSLV3); + TCPv6Transport receiveTransportUnderTest(recvDescriptor); + receiveTransportUnderTest.init(); - std::this_thread::sleep_for(std::chrono::seconds(5)); + TCPv6TransportDescriptor sendDescriptor; + sendDescriptor.apply_security = true; + sendDescriptor.tls_config.password = "testkey"; + sendDescriptor.tls_config.cert_chain_file = "mainsubcert.pem"; + sendDescriptor.tls_config.private_key_file = "mainsubkey.pem"; + sendDescriptor.tls_config.verify_file = "maincacert.pem"; + sendDescriptor.tls_config.verify_mode = TLSVerifyMode::VERIFY_PEER; + sendDescriptor.tls_config.add_option(TLSOptions::DEFAULT_WORKAROUNDS); + sendDescriptor.tls_config.add_option(TLSOptions::SINGLE_DH_USE); + sendDescriptor.tls_config.add_option(TLSOptions::NO_COMPRESSION); + sendDescriptor.tls_config.add_option(TLSOptions::NO_SSLV2); + sendDescriptor.tls_config.add_option(TLSOptions::NO_SSLV3); + TCPv6Transport sendTransportUnderTest(sendDescriptor); + sendTransportUnderTest.init(); - Semaphore sem; - std::function recCallback = [&]() - { - EXPECT_EQ(memcmp(message,msg_recv->data,5), 0); - sem.post(); - }; + Locator_t inputLocator; + inputLocator.kind = LOCATOR_KIND_TCPv6; + inputLocator.port = g_default_port; + IPLocator::setIPv4(inputLocator, "::1"); + IPLocator::setLogicalPort(inputLocator, 7410); - msg_recv->setCallback(recCallback); + Locator_t outputLocator; + outputLocator.kind = LOCATOR_KIND_TCPv6; + IPLocator::setIPv4(outputLocator, "::1"); + outputLocator.port = g_default_port; + IPLocator::setLogicalPort(outputLocator, 7410); - auto sendThreadFunction = [&]() { - EXPECT_TRUE(transportUnderTest.send(message, 5, outputChannelLocator, localLocator)); - }; - - senderThread.reset(new std::thread(sendThreadFunction)); - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - senderThread->join(); - sem.wait(); - ASSERT_TRUE(transportUnderTest.CloseOutputChannel(outputChannelLocator)); - } - - TEST_F(TCPv6Tests, send_to_loopback) - { - TCPv6Transport transportUnderTest(descriptor); - transportUnderTest.init(); - - Locator_t multicastLocator; - multicastLocator.set_port(g_default_port); - multicastLocator.kind = LOCATOR_KIND_TCPv6; - IPLocator::setIPv6(multicastLocator, 0xff31, 0, 0, 0, 0, 0, 0, 0); - - Locator_t outputChannelLocator; - outputChannelLocator.set_port(g_default_port + 1); - outputChannelLocator.kind = LOCATOR_KIND_TCPv6; - IPLocator::setIPv6(outputChannelLocator, 0,0,0,0,0,0,0,1); // Loopback - - MockReceiverResource receiver(transportUnderTest, multicastLocator); - MockMessageReceiver *msg_recv = dynamic_cast(receiver.CreateMessageReceiver()); + MockReceiverResource receiver(receiveTransportUnderTest, inputLocator); + MockMessageReceiver *msg_recv = dynamic_cast(receiver.CreateMessageReceiver()); + ASSERT_TRUE(receiveTransportUnderTest.IsInputChannelOpen(inputLocator)); - ASSERT_TRUE(transportUnderTest.OpenOutputChannel(outputChannelLocator)); - ASSERT_TRUE(transportUnderTest.IsInputChannelOpen(multicastLocator)); - octet message[5] = { 'H','e','l','l','o' }; + ASSERT_TRUE(sendTransportUnderTest.OpenOutputChannel(outputLocator)); + octet message[5] = { 'H','e','l','l','o' }; - Semaphore sem; - std::function recCallback = [&]() - { - EXPECT_EQ(memcmp(message,msg_recv->data,5), 0); - sem.post(); + Semaphore sem; + std::function recCallback = [&]() + { + EXPECT_EQ(memcmp(message, msg_recv->data, 5), 0); + sem.post(); + }; }; msg_recv->setCallback(recCallback); diff --git a/test/unittest/xmlparser/XMLParserTests.cpp b/test/unittest/xmlparser/XMLParserTests.cpp index 6635241ae55..9d78479b5cd 100644 --- a/test/unittest/xmlparser/XMLParserTests.cpp +++ b/test/unittest/xmlparser/XMLParserTests.cpp @@ -1020,11 +1020,7 @@ TEST_F(XMLParserTests, parseXMLTransportData) false\ false\ false\ -<<<<<<< HEAD -======= - true\ 100\ ->>>>>>> 8103cf042 (TCP first message loss (#4454)) \ \ 12\ @@ -1121,15 +1117,9 @@ TEST_F(XMLParserTests, parseXMLTransportData) EXPECT_EQ(pTCPv6Desc->logical_port_increment, 2u); EXPECT_EQ(pTCPv6Desc->listening_ports[0], 5100u); EXPECT_EQ(pTCPv6Desc->listening_ports[1], 5200u); -<<<<<<< HEAD EXPECT_EQ(pTCPv4Desc->keep_alive_thread, modified_thread_settings); EXPECT_EQ(pTCPv4Desc->accept_thread, modified_thread_settings); -======= - EXPECT_EQ(pTCPv6Desc->keep_alive_thread, modified_thread_settings); - EXPECT_EQ(pTCPv6Desc->non_blocking_send, true); - EXPECT_EQ(pTCPv6Desc->accept_thread, modified_thread_settings); EXPECT_EQ(pTCPv6Desc->tcp_negotiation_timeout, 100u); ->>>>>>> 8103cf042 (TCP first message loss (#4454)) EXPECT_EQ(pTCPv6Desc->default_reception_threads(), modified_thread_settings); EXPECT_EQ(pTCPv6Desc->get_thread_config_for_port(12345), modified_thread_settings); EXPECT_EQ(pTCPv6Desc->get_thread_config_for_port(12346), modified_thread_settings);