From e7c3f9fc32d03d1eead049c69162ea24c8cceff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Thu, 22 Jan 2026 14:30:13 +0100 Subject: [PATCH 01/18] In DS now clients behave like super_clients MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- .../discovery/database/DiscoveryDataBase.cpp | 133 +++--------------- .../common/BlackboxTestsDiscovery.cpp | 10 +- .../common/DDSBlackboxTestsDSEasyMode.cpp | 4 +- .../client_server_dynamic_discovery.py | 18 ++- 4 files changed, 41 insertions(+), 124 deletions(-) diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp index 1f0c1908370..8d6590569c7 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp @@ -762,8 +762,7 @@ void DiscoveryDataBase::create_new_participant_from_change_( } // If it is local and server we have to create virtual endpoints, except for our own server - if (change_guid.guidPrefix != server_guid_prefix_ && - !ret.first->second.is_client() && ret.first->second.is_local()) + if (change_guid.guidPrefix != server_guid_prefix_ && ret.first->second.is_local()) { // Match new server and create virtual endpoints match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); @@ -804,7 +803,7 @@ void DiscoveryDataBase::update_participant_from_change_( update_change_and_unmatch_(ch, participant_info); // If it is local and server we have to create virtual endpoints, except for our own server - if (change_guid.guidPrefix != server_guid_prefix_ && !change_data.is_client() && change_data.is_local()) + if (change_guid.guidPrefix != server_guid_prefix_ && change_data.is_local()) { // Match new server and create virtual endpoints // NOTE: match after having updated the change, so virtual endpoints are not discarded for having @@ -833,13 +832,8 @@ void DiscoveryDataBase::update_participant_from_change_( // Update change update_change_and_unmatch_(ch, participant_info); - // If the participant changes to server local, virtual endpoints must be added - // If it is local and server the only possibility is it was a remote server and it must be converted to local - if (!change_data.is_client()) - { - // NOTE: match after having updated the change in order to send the new Data(P) - match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); - } + // NOTE: match after having updated the change in order to send the new Data(P) + match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); // Treat as a new participant found new_updates_++; @@ -1199,114 +1193,31 @@ void DiscoveryDataBase::match_writer_reader_( } DiscoveryParticipantInfo& reader_participant_info = p_rit->second; - // virtual - needs info and give none - // local - needs info and give info - // external - needs none and give info - // writer needs info = add writer participant in reader ack list - // writer give info = add reader participant in writer ack list - - // TODO reduce number of cases. This is more visual, but can be reduce joining them - if (writer_info.is_virtual()) + // Always exchange all information between all participants (no filtering) + // Skip only if it's a virtual endpoint matching with another virtual endpoint + if (writer_info.is_virtual() && reader_info.is_virtual()) { - // Writer virtual - - // If reader is virtual OR not local, do not exchange info. Servers do not redirect Data(p) of remote clients. - // Otherwise, writer needs all the info from this endpoint - if (!reader_info.is_virtual() && - (reader_participant_info.is_local() || writer_participant_info.is_superclient())) - { - // Only if they do not have the info yet - if (!reader_participant_info.is_relevant_participant(writer_guid.guidPrefix)) - { - reader_participant_info.add_or_update_ack_participant(writer_guid.guidPrefix); - } + return; + } - if (!reader_info.is_relevant_participant(writer_guid.guidPrefix)) - { - reader_info.add_or_update_ack_participant(writer_guid.guidPrefix); - } - } + // Add writer's participant to reader's relevant list + if (!reader_participant_info.is_relevant_participant(writer_guid.guidPrefix)) + { + reader_participant_info.add_or_update_ack_participant(writer_guid.guidPrefix); } - else if (writer_participant_info.is_local()) + if (!reader_info.is_relevant_participant(writer_guid.guidPrefix)) { - // Writer local - - if (reader_info.is_virtual()) - { - // Reader virtual - // Writer gives info to reader - // Only if they do not have the info yet - if (!writer_participant_info.is_relevant_participant(reader_guid.guidPrefix)) - { - writer_participant_info.add_or_update_ack_participant(reader_guid.guidPrefix); - } - - if (!writer_info.is_relevant_participant(reader_guid.guidPrefix)) - { - writer_info.add_or_update_ack_participant(reader_guid.guidPrefix); - } - } - else if (reader_participant_info.is_local()) - { - // Reader local - // Both exchange info - // Only if they do not have the info yet - if (!writer_participant_info.is_relevant_participant(reader_guid.guidPrefix)) - { - writer_participant_info.add_or_update_ack_participant(reader_guid.guidPrefix); - } - - if (!writer_info.is_relevant_participant(reader_guid.guidPrefix)) - { - writer_info.add_or_update_ack_participant(reader_guid.guidPrefix); - } - - if (!reader_participant_info.is_relevant_participant(writer_guid.guidPrefix)) - { - reader_participant_info.add_or_update_ack_participant(writer_guid.guidPrefix); - } - - if (!reader_info.is_relevant_participant(writer_guid.guidPrefix)) - { - reader_info.add_or_update_ack_participant(writer_guid.guidPrefix); - } - } - else - { - // Reader external - // Reader gives info to writer - // Only if they do not have the info yet - if (!reader_participant_info.is_relevant_participant(writer_guid.guidPrefix)) - { - reader_participant_info.add_or_update_ack_participant(writer_guid.guidPrefix); - } + reader_info.add_or_update_ack_participant(writer_guid.guidPrefix); + } - if (!reader_info.is_relevant_participant(writer_guid.guidPrefix)) - { - reader_info.add_or_update_ack_participant(writer_guid.guidPrefix); - } - } + // Add reader's participant to writer's relevant list + if (!writer_participant_info.is_relevant_participant(reader_guid.guidPrefix)) + { + writer_participant_info.add_or_update_ack_participant(reader_guid.guidPrefix); } - else + if (!writer_info.is_relevant_participant(reader_guid.guidPrefix)) { - // Writer external - - // If reader is external OR virtual, do not exchange info. Servers do not redirect Data(p) of remote clients. - // Otherwise, reader needs all the info from this endpoint - if (reader_participant_info.is_local() && - (!reader_info.is_virtual() || reader_participant_info.is_superclient())) - { - // Only if they do not have the info yet - if (!writer_participant_info.is_relevant_participant(reader_guid.guidPrefix)) - { - writer_participant_info.add_or_update_ack_participant(reader_guid.guidPrefix); - } - - if (!writer_info.is_relevant_participant(reader_guid.guidPrefix)) - { - writer_info.add_or_update_ack_participant(reader_guid.guidPrefix); - } - } + writer_info.add_or_update_ack_participant(reader_guid.guidPrefix); } } diff --git a/test/blackbox/common/BlackboxTestsDiscovery.cpp b/test/blackbox/common/BlackboxTestsDiscovery.cpp index 063fed46a1f..21eb6737abc 100644 --- a/test/blackbox/common/BlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/BlackboxTestsDiscovery.cpp @@ -2173,7 +2173,7 @@ TEST_P(Discovery, discovery_server_pdp_messages_sent) server->wait_discovery(std::chrono::seconds(5), 1, true); // Let some time for the server to run the internal routine and check if it sent Data(p) std::this_thread::sleep_for(std::chrono::seconds(3)); - EXPECT_EQ(num_data_p_sends.load(std::memory_order::memory_order_seq_cst), 1u); + EXPECT_EQ(num_data_p_sends.load(std::memory_order::memory_order_seq_cst), 2u); // Init client 2 ASSERT_TRUE(client_2.wire_protocol(client_qos) @@ -2185,7 +2185,7 @@ TEST_P(Discovery, discovery_server_pdp_messages_sent) server->wait_discovery(std::chrono::seconds(5), 2, true); // Let some time for the server to run the internal routine and check if it sent Data(p) std::this_thread::sleep_for(std::chrono::seconds(3)); - EXPECT_EQ(num_data_p_sends.load(std::memory_order::memory_order_seq_cst), 2u); + EXPECT_EQ(num_data_p_sends.load(std::memory_order::memory_order_seq_cst), 5u); // Init client 3 ASSERT_TRUE(client_3.wire_protocol(client_qos) @@ -2197,7 +2197,7 @@ TEST_P(Discovery, discovery_server_pdp_messages_sent) server->wait_discovery(std::chrono::seconds(5), 3, true); // Let some time for the server to run the internal routine and check if it sent Data(p) std::this_thread::sleep_for(std::chrono::seconds(3)); - EXPECT_EQ(num_data_p_sends.load(std::memory_order::memory_order_seq_cst), 3u); + EXPECT_EQ(num_data_p_sends.load(std::memory_order::memory_order_seq_cst), 9u); } // This test checks that a Discover Server does not send duplicated EDP messages when its routine @@ -2378,8 +2378,8 @@ TEST_P(Discovery, discovery_server_edp_messages_sent) // Ensure that no additional Data(r/w) messages are sent by DS routine std::this_thread::sleep_for(std::chrono::seconds(15)); - EXPECT_EQ(num_data_r_w_sends_s1.load(std::memory_order::memory_order_seq_cst), 2u); - EXPECT_EQ(num_data_r_w_sends_s2.load(std::memory_order::memory_order_seq_cst), 2u); + EXPECT_EQ(num_data_r_w_sends_s1.load(std::memory_order::memory_order_seq_cst), 3u); + EXPECT_EQ(num_data_r_w_sends_s2.load(std::memory_order::memory_order_seq_cst), 3u); } // This is a regression test for Redmine #23088, which corrects the following data race in the discovery server: diff --git a/test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp b/test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp index 6f19ac413a4..158a855c4f7 100644 --- a/test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp @@ -242,8 +242,8 @@ TEST(DSEasyMode, easy_discovery_mode_env_discovery_info) for (auto& writer : writers) { - // Writers shall discover SERVER participant only - ASSERT_LE(writer->get_participants_matched(), 1u); + // Writers shall also all the other participants + ASSERT_LE(writer->get_participants_matched(), num_writers + 1u); } // Stop server diff --git a/test/dds/discovery/client_server_dynamic_discovery.py b/test/dds/discovery/client_server_dynamic_discovery.py index 9d7a6635622..b922c920daa 100644 --- a/test/dds/discovery/client_server_dynamic_discovery.py +++ b/test/dds/discovery/client_server_dynamic_discovery.py @@ -59,12 +59,18 @@ def first_step(outq): print(line) sys.stdout.flush() - assert '44.53.00.5f.45.50.52.4f.53.49.4d.41' in line - assert 'discovered participant' in line - count = count + 1 - if 'discovered participant 44.53.00.5f.45.50.52.4f.53.49.4d.41|0.0.1.c1: 1' in line: - print('CLIENT OVERRIDE discovered SERVER 1') - server_1_discover_client = True + if 'discovered participant' in line: + assert '44.53.00.5f.45.50.52.4f.53.49.4d.41' in line + count = count + 1 + if 'discovered participant 44.53.00.5f.45.50.52.4f.53.49.4d.41|0.0.1.c1: 1' in line: + print('CLIENT OVERRIDE discovered SERVER 1') + server_1_discover_client = True + elif 'Warning' in line: + # SUPER_CLIENT or non-overriden CLIENT participants may generate this warning + assert 'Trying to add Discovery Servers to a participant which is not a SERVER, BACKUP or an' in line + assert 'overriden CLIENT (SIMPLE participant transformed into CLIENT with the environment variable)' in line + else: + assert 'detected changes on participant' in line except queue.Empty: # Ensure that 2 s has passed so the file watch can detect that the file has changed if server_1_discover_client and count >= 2 and (time.time() - initial_time) > 2: From 2f2ca428973e7b8ade55f45df3d1b9ac0521999a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Thu, 22 Jan 2026 14:38:03 +0100 Subject: [PATCH 02/18] Uncrustify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- test/blackbox/common/BlackboxTestsDiscovery.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/blackbox/common/BlackboxTestsDiscovery.cpp b/test/blackbox/common/BlackboxTestsDiscovery.cpp index 21eb6737abc..bb7224b9cb2 100644 --- a/test/blackbox/common/BlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/BlackboxTestsDiscovery.cpp @@ -65,7 +65,8 @@ class Discovery : public testing::TestWithParam { case INTRAPROCESS: library_settings.intraprocess_delivery = eprosima::fastdds::IntraprocessDeliveryType::INTRAPROCESS_FULL; - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->set_library_settings(library_settings); + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->set_library_settings( + library_settings); break; case DATASHARING: enable_datasharing = true; @@ -83,7 +84,8 @@ class Discovery : public testing::TestWithParam { case INTRAPROCESS: library_settings.intraprocess_delivery = eprosima::fastdds::IntraprocessDeliveryType::INTRAPROCESS_OFF; - eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->set_library_settings(library_settings); + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->set_library_settings( + library_settings); break; case DATASHARING: enable_datasharing = false; From 31bd9f662ac24a7f1f165e78c1f5ebd9c1ca4654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Thu, 22 Jan 2026 14:48:50 +0100 Subject: [PATCH 03/18] Check in match_new_server_ if it client or super_client instead of just super_client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- .../builtin/discovery/database/DiscoveryDataBase.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp index 8d6590569c7..bce8dd94c6f 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp @@ -604,7 +604,7 @@ void DiscoveryDataBase::create_participant_from_change_( void DiscoveryDataBase::match_new_server_( eprosima::fastdds::rtps::GuidPrefix_t& participant_prefix, - bool is_superclient) + bool is_client_or_super_client) { // Send Our DATA(p) to the new participant. // If this is not done, our data could be skipped afterwards because of a gap sent in newer DATA(p)s, @@ -613,7 +613,7 @@ void DiscoveryDataBase::match_new_server_( assert(our_data_it != participants_.end()); add_pdp_to_send_(our_data_it->second.change()); - if (!is_superclient) + if (!is_client_or_super_client) { // To obtain a mesh topology with servers, we need to: // - Make all known servers relevant to the new server @@ -765,7 +765,7 @@ void DiscoveryDataBase::create_new_participant_from_change_( if (change_guid.guidPrefix != server_guid_prefix_ && ret.first->second.is_local()) { // Match new server and create virtual endpoints - match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); + match_new_server_(change_guid.guidPrefix, change_data.is_client() || change_data.is_superclient()); } } else @@ -808,7 +808,7 @@ void DiscoveryDataBase::update_participant_from_change_( // Match new server and create virtual endpoints // NOTE: match after having updated the change, so virtual endpoints are not discarded for having // an associated unalive participant - match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); + match_new_server_(change_guid.guidPrefix, change_data.is_client() || change_data.is_superclient()); } // Treat as a new participant found @@ -833,7 +833,7 @@ void DiscoveryDataBase::update_participant_from_change_( update_change_and_unmatch_(ch, participant_info); // NOTE: match after having updated the change in order to send the new Data(P) - match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); + match_new_server_(change_guid.guidPrefix, change_data.is_client() || change_data.is_superclient()); // Treat as a new participant found new_updates_++; From 5430989036f29b51fa8c87738c8299dbbc9453ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Thu, 22 Jan 2026 14:53:28 +0100 Subject: [PATCH 04/18] Fix comment explanation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp b/test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp index 158a855c4f7..2b3b7b40e34 100644 --- a/test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp +++ b/test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp @@ -242,7 +242,7 @@ TEST(DSEasyMode, easy_discovery_mode_env_discovery_info) for (auto& writer : writers) { - // Writers shall also all the other participants + // Writers shall discover all the other participants (CLIENT) ASSERT_LE(writer->get_participants_matched(), num_writers + 1u); } From 4452fcaf4012550d006526445c4bd56ecf3c5af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Thu, 22 Jan 2026 15:42:41 +0100 Subject: [PATCH 05/18] Modify variable name in match_new_server_ header check if it is client or super_client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp index ceeb1051cf3..4b5f0d0d753 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp @@ -397,7 +397,7 @@ class DiscoveryDataBase void match_new_server_( eprosima::fastdds::rtps::GuidPrefix_t& participant_prefix, - bool is_superclient); + bool is_client_or_super_client); void create_virtual_endpoints_( eprosima::fastdds::rtps::GuidPrefix_t& participant_prefix); From a045414d671aa5049a7e09e443d72ed684773731 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Thu, 22 Jan 2026 15:49:03 +0100 Subject: [PATCH 06/18] Add feature to versions.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- versions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/versions.md b/versions.md index 4c9a52b1acb..a935274ebf8 100644 --- a/versions.md +++ b/versions.md @@ -2,6 +2,7 @@ Forthcoming ----------- * ResourceLimitsQosPolicy maximum limits default values changed to LENGTH_UNLIMITED (i.e. infinite). +* Discovery Server CLIENT participants now behave like SUPER_CLIENT participants. Version v3.4.0 -------------- From 484641f21ed2f6f502b5168581f8a08a75cdc52c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Thu, 22 Jan 2026 15:53:16 +0100 Subject: [PATCH 07/18] Uncrustify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp index 4b5f0d0d753..75f1747f872 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp @@ -91,7 +91,8 @@ class DiscoveryDataBase AckedFunctor( AckedFunctor&& r) // delegates in copy constructor - : AckedFunctor(r) + : AckedFunctor( + r) { } From a6642467d6317f7aa0d25e49be9d33f636123ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Fri, 23 Jan 2026 10:08:31 +0100 Subject: [PATCH 08/18] Remove discovery_server tests from CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- .github/workflows/reusable-sanitizers-ci.yml | 102 ------------------ .github/workflows/reusable-ubuntu-ci.yml | 103 ------------------- 2 files changed, 205 deletions(-) diff --git a/.github/workflows/reusable-sanitizers-ci.yml b/.github/workflows/reusable-sanitizers-ci.yml index e6bca221edf..374d22fcbb8 100644 --- a/.github/workflows/reusable-sanitizers-ci.yml +++ b/.github/workflows/reusable-sanitizers-ci.yml @@ -250,108 +250,6 @@ jobs: --output-file $GITHUB_STEP_SUMMARY \ --sanitizer asan - asan_discovery_server_test: - if: ${{ inputs.run_asan_discovery_server == true }} - needs: asan_fastdds_build - runs-on: ubuntu-22.04 - steps: - - name: Free disk space - uses: eProsima/eProsima-CI/ubuntu/free_disk_space@v0 - - - name: Download build artifacts - uses: eProsima/eProsima-CI/external/download-artifact@v0 - with: - name: build_artifacts_fastdds_asan_${{ inputs.label }} - path: ${{ github.workspace }} - - - name: Install Fix Python version - uses: eProsima/eProsima-CI/external/setup-python@v0 - with: - python-version: '3.11' - - - name: Get minimum supported version of CMake - uses: eProsima/eProsima-CI/external/get-cmake@v0 - with: - cmakeVersion: '3.22.6' - - - name: Install apt packages - uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0 - with: - packages: curl grep libasio-dev libtinyxml2-dev python3 python3-pip software-properties-common wget - - - name: Install colcon - uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0 - - - name: Install Python dependencies - uses: eProsima/eProsima-CI/ubuntu/install_python_packages@v0 - with: - packages: vcstool setuptools gcovr tomark xmltodict jsondiff pandas psutil - - - name: Setup CCache - uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 - if: ${{ !always() }} - with: - api_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get Discovery Server branch - id: get_discovery_server_branch - uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@v0 - with: - remote_repository: eProsima/Discovery-Server - fallback_branch: ${{ inputs.discovery_server_ref }} - - - name: Download Discovery Server repo - uses: eProsima/eProsima-CI/external/checkout@v0 - with: - repository: eProsima/Discovery-Server - path: src/discovery-server - ref: ${{ steps.get_discovery_server_branch.outputs.deduced_branch }} - - - name: Show .meta file - id: show_meta - run: | - cat ${{ github.workspace }}/src/fastdds/.github/workflows/config/asan.meta - - - name: Colcon build - continue-on-error: false - uses: eProsima/eProsima-CI/ubuntu/colcon_build@v0 - with: - colcon_meta_file: ${{ github.workspace }}/src/fastdds/.github/workflows/config/asan.meta - colcon_build_args: ${{ inputs.colcon_build_args }} - cmake_args: ${{ inputs.cmake_args }} - cmake_args_default: '' - cmake_build_type: 'Debug' - workspace: ${{ github.workspace }} - workspace_dependencies: '' - - - name: Colcon test - id: test - continue-on-error: true - uses: eProsima/eProsima-CI/ubuntu/colcon_test@v0 - with: - colcon_args_default: '' - colcon_test_args: ${{ inputs.colcon_test_args }} - colcon_test_args_default: '--event-handlers=console_direct+ --return-code-on-test-failure' - ctest_args: ${{ inputs.ctest_args }} - ctest_args_default: '--timeout 300 --label-exclude "xfail"' - packages_names: discovery-server - workspace: ${{ github.workspace }} - workspace_dependencies: '' - test_report_artifact: ${{ format('test_report_{0}_{1}', inputs.label, github.job) }} - - - name: Report sanitizer errors - run: | - bash src/fastdds/.github/workflows/utils/specific_errors_filter.sh \ - "==ERROR:" \ - log/latest_test/discovery-server/stdout_stderr.log \ - _tmp_specific_error_file.log - - python3 src/fastdds/.github/workflows/utils/log_parser.py \ - --log-file log/latest_test/discovery-server/stdout_stderr.log \ - --specific-error-file _tmp_specific_error_file.log \ - --output-file $GITHUB_STEP_SUMMARY \ - --sanitizer=asan - tsan_fastdds_test: if: ${{ inputs.run_tsan_fastdds == true }} runs-on: ubuntu-22.04 diff --git a/.github/workflows/reusable-ubuntu-ci.yml b/.github/workflows/reusable-ubuntu-ci.yml index 9a635cf0689..ffdcb1030f9 100644 --- a/.github/workflows/reusable-ubuntu-ci.yml +++ b/.github/workflows/reusable-ubuntu-ci.yml @@ -639,109 +639,6 @@ jobs: cmake_build_type: ${{ matrix.cmake-build-type }} workspace: ${{ github.workspace }} - fastdds_discovery_server_test: - needs: fastdds_build - runs-on: ${{ inputs.os-image }} - strategy: - fail-fast: false - matrix: - cmake-build-type: - - 'RelWithDebInfo' - steps: - - name: Free disk space - uses: eProsima/eProsima-CI/ubuntu/free_disk_space@v0 - - - name: Download build artifacts - uses: eProsima/eProsima-CI/external/download-artifact@v0 - with: - name: fastdds_build_${{ inputs.label }} - path: ${{ github.workspace }} - - - name: Install Fix Python version - uses: eProsima/eProsima-CI/external/setup-python@v0 - with: - python-version: '3.11' - - - name: Get minimum supported version of CMake - uses: eProsima/eProsima-CI/external/get-cmake@v0 - with: - cmakeVersion: '3.22.6' - - - name: Install apt packages - uses: eProsima/eProsima-CI/ubuntu/install_apt_packages@v0 - with: - packages: libasio-dev libtinyxml2-dev libssl-dev - - - name: Install colcon - uses: eProsima/eProsima-CI/ubuntu/install_colcon@v0 - - - name: Install Python dependencies - uses: eProsima/eProsima-CI/ubuntu/install_python_packages@v0 - with: - packages: vcstool xmlschema xmltodict==0.13.0 jsondiff==2.0.0 pandas==1.5.2 psutil - - - name: Setup CCache - uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 - if: ${{ inputs.use-ccache == true }} - with: - api_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get Discovery Server branch - id: get_discovery_server_branch - uses: eProsima/eProsima-CI/ubuntu/get_related_branch_from_repo@v0 - with: - remote_repository: eProsima/Discovery-Server - fallback_branch: ${{ env.discovery-server-branch }} - - - name: Download Discovery Server repo - uses: eProsima/eProsima-CI/external/checkout@v0 - with: - repository: eProsima/Discovery-Server - path: src/discovery_server - ref: ${{ steps.get_discovery_server_branch.outputs.deduced_branch }} - - - name: Fetch Fast DDS CI dependencies - uses: eProsima/eProsima-CI/ubuntu/vcs_import@v0 - with: - vcs_repos_file: ${{ github.workspace }}/src/fastdds/.github/workflows/config/fastdds_test.repos - destination_workspace: src - skip_existing: 'true' - - - name: Colcon build - continue-on-error: false - uses: eProsima/eProsima-CI/ubuntu/colcon_build@v0 - with: - colcon_meta_file: ${{ github.workspace }}/src/fastdds/.github/workflows/config/fastdds_build.meta ${{ github.workspace }}/src/fastdds/.github/workflows/config/discovery_server.meta - colcon_build_args: ${{ inputs.colcon-args }} - cmake_args: '${{ env.security-cmake-flag }} ${{ inputs.cmake-args }}' - cmake_args_default: ${{ env.colcon-build-default-cmake-args }} - cmake_build_type: ${{ matrix.cmake-build-type }} - workspace: ${{ github.workspace }} - - - name: Colcon test - id: discovery_server_test - if: ${{ inputs.run-tests == true }} - uses: eProsima/eProsima-CI/ubuntu/colcon_test@v0 - with: - colcon_meta_file: ${{ github.workspace }}/src/fastdds/.github/workflows/config/discovery_server.meta - colcon_test_args: ${{ inputs.colcon-args }} - colcon_test_args_default: --event-handlers=console_direct+ - ctest_args: ${{ inputs.ctest-args }} - packages_names: discovery-server - workspace: ${{ github.workspace }} - workspace_dependencies: '' - test_report_artifact: ${{ format('test_report_{0}_{1}_{2}', inputs.label, github.job, join(matrix.*, '_')) }} - - - name: Discovery server test summary - uses: eProsima/eProsima-CI/ubuntu/junit_summary@v0 - if: ${{ !cancelled() && inputs.run-tests == true }} - with: - junit_reports_dir: "${{ steps.discovery_server_test.outputs.ctest_results_path }}" - print_summary: 'True' - show_failed: 'True' - show_disabled: 'False' - show_skipped: 'False' - fastdds_alternative_builds: needs: fastdds_build runs-on: ${{ inputs.os-image }} From 125ca723cfe1ae64cd0facd7ce7e368bfdf3f7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Mon, 26 Jan 2026 15:37:28 +0100 Subject: [PATCH 09/18] Fix memory bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- .../discovery/database/DiscoveryDataBase.cpp | 13 +++++++++---- test/blackbox/common/BlackboxTestsDiscovery.cpp | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp index bce8dd94c6f..39caaff2dd4 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp @@ -803,12 +803,12 @@ void DiscoveryDataBase::update_participant_from_change_( update_change_and_unmatch_(ch, participant_info); // If it is local and server we have to create virtual endpoints, except for our own server - if (change_guid.guidPrefix != server_guid_prefix_ && change_data.is_local()) + if (change_guid.guidPrefix != server_guid_prefix_ && !change_data.is_client() && change_data.is_local()) { // Match new server and create virtual endpoints // NOTE: match after having updated the change, so virtual endpoints are not discarded for having // an associated unalive participant - match_new_server_(change_guid.guidPrefix, change_data.is_client() || change_data.is_superclient()); + match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); } // Treat as a new participant found @@ -832,8 +832,13 @@ void DiscoveryDataBase::update_participant_from_change_( // Update change update_change_and_unmatch_(ch, participant_info); - // NOTE: match after having updated the change in order to send the new Data(P) - match_new_server_(change_guid.guidPrefix, change_data.is_client() || change_data.is_superclient()); + // If the participant changes to server local, virtual endpoints must be added + // If it is local and server the only possibility is it was a remote server and it must be converted to local + if (!change_data.is_client()) + { + // NOTE: match after having updated the change in order to send the new Data(P) + match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); + } // Treat as a new participant found new_updates_++; diff --git a/test/blackbox/common/BlackboxTestsDiscovery.cpp b/test/blackbox/common/BlackboxTestsDiscovery.cpp index bb7224b9cb2..6a6bf9dd482 100644 --- a/test/blackbox/common/BlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/BlackboxTestsDiscovery.cpp @@ -2380,8 +2380,8 @@ TEST_P(Discovery, discovery_server_edp_messages_sent) // Ensure that no additional Data(r/w) messages are sent by DS routine std::this_thread::sleep_for(std::chrono::seconds(15)); - EXPECT_EQ(num_data_r_w_sends_s1.load(std::memory_order::memory_order_seq_cst), 3u); - EXPECT_EQ(num_data_r_w_sends_s2.load(std::memory_order::memory_order_seq_cst), 3u); + EXPECT_EQ(num_data_r_w_sends_s1.load(std::memory_order::memory_order_seq_cst), 2u); + EXPECT_EQ(num_data_r_w_sends_s2.load(std::memory_order::memory_order_seq_cst), 2u); } // This is a regression test for Redmine #23088, which corrects the following data race in the discovery server: From 054971a73e15390f18dd6da0b64269bca87f94dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Tue, 27 Jan 2026 15:09:17 +0100 Subject: [PATCH 10/18] For all discovered clients, we create DiscoveryParticipantChangeData with is_client_ = false and is_superclient_ = true MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- .../rtps/builtin/discovery/participant/PDPServerListener.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp index a08795f82c7..23c42689201 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp @@ -191,9 +191,9 @@ void PDPServerListener::on_new_cache_change_added( change.get(), ddb::DiscoveryParticipantChangeData( participant_data.metatraffic_locators, - is_client, + false, is_local, - participant_type_str == ParticipantType::SUPER_CLIENT))) + is_client || participant_type_str == ParticipantType::SUPER_CLIENT))) { // Remove change from PDP reader history, but do not return it to the pool. From here on, the discovery // database takes ownership of the CacheChange_t. Henceforth there are no references to the change. From 6dc22dbff1a2358bccf45f084e35722c1bd3ecbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Tue, 27 Jan 2026 15:10:58 +0100 Subject: [PATCH 11/18] Uncrustify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- test/blackbox/common/BlackboxTestsDiscovery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/blackbox/common/BlackboxTestsDiscovery.cpp b/test/blackbox/common/BlackboxTestsDiscovery.cpp index 6a6bf9dd482..47fca5b9354 100644 --- a/test/blackbox/common/BlackboxTestsDiscovery.cpp +++ b/test/blackbox/common/BlackboxTestsDiscovery.cpp @@ -1023,7 +1023,7 @@ TEST_P(Discovery, PubSubAsReliableHelloworldEndpointUserData) } //! Auxiliar method for discovering participants tests -template +template static void discoverParticipantsTest( bool avoid_multicast, size_t n_participants, From 30a9ad70fb622b003d025dcde1385ed1cf4c2911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Tue, 27 Jan 2026 16:24:53 +0100 Subject: [PATCH 12/18] Remove is_client altogether MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- .../discovery/database/DiscoveryDataBase.cpp | 14 ++++++-------- .../discovery/database/DiscoveryDataBase.hpp | 2 +- .../database/DiscoveryParticipantChangeData.hpp | 14 -------------- .../database/DiscoveryParticipantInfo.hpp | 5 ----- .../database/backup/SharedBackupFunctions.hpp | 1 - .../builtin/discovery/participant/PDPServer.cpp | 2 +- .../discovery/participant/PDPServerListener.cpp | 1 - 7 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp index 39caaff2dd4..eeabaa10671 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp @@ -604,7 +604,7 @@ void DiscoveryDataBase::create_participant_from_change_( void DiscoveryDataBase::match_new_server_( eprosima::fastdds::rtps::GuidPrefix_t& participant_prefix, - bool is_client_or_super_client) + bool is_super_client) { // Send Our DATA(p) to the new participant. // If this is not done, our data could be skipped afterwards because of a gap sent in newer DATA(p)s, @@ -613,7 +613,7 @@ void DiscoveryDataBase::match_new_server_( assert(our_data_it != participants_.end()); add_pdp_to_send_(our_data_it->second.change()); - if (!is_client_or_super_client) + if (!is_super_client) { // To obtain a mesh topology with servers, we need to: // - Make all known servers relevant to the new server @@ -622,7 +622,7 @@ void DiscoveryDataBase::match_new_server_( // - Send Data(p) of the new server to all other servers for (auto& part : participants_) { - if (part.first != server_guid_prefix_ && !part.second.is_client() && !part.second.is_superclient()) + if (part.first != server_guid_prefix_ && !part.second.is_superclient()) { if (part.first == participant_prefix) { @@ -722,7 +722,6 @@ bool DiscoveryDataBase::participant_data_has_changed_( const DiscoveryParticipantChangeData& new_change_data) { return !(participant_info.is_local() == new_change_data.is_local() && - participant_info.is_client() == new_change_data.is_client() && participant_info.is_superclient() == new_change_data.is_superclient()); } @@ -765,7 +764,7 @@ void DiscoveryDataBase::create_new_participant_from_change_( if (change_guid.guidPrefix != server_guid_prefix_ && ret.first->second.is_local()) { // Match new server and create virtual endpoints - match_new_server_(change_guid.guidPrefix, change_data.is_client() || change_data.is_superclient()); + match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); } } else @@ -803,7 +802,7 @@ void DiscoveryDataBase::update_participant_from_change_( update_change_and_unmatch_(ch, participant_info); // If it is local and server we have to create virtual endpoints, except for our own server - if (change_guid.guidPrefix != server_guid_prefix_ && !change_data.is_client() && change_data.is_local()) + if (change_guid.guidPrefix != server_guid_prefix_ && !change_data.is_superclient() && change_data.is_local()) { // Match new server and create virtual endpoints // NOTE: match after having updated the change, so virtual endpoints are not discarded for having @@ -834,7 +833,7 @@ void DiscoveryDataBase::update_participant_from_change_( // If the participant changes to server local, virtual endpoints must be added // If it is local and server the only possibility is it was a remote server and it must be converted to local - if (!change_data.is_client()) + if (!change_data.is_superclient()) { // NOTE: match after having updated the change in order to send the new Data(P) match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); @@ -2467,7 +2466,6 @@ bool DiscoveryDataBase::from_json( // Populate DiscoveryParticipantChangeData DiscoveryParticipantChangeData dpcd( rll, - it.value()["is_client"].get(), it.value()["is_local"].get()); // Populate DiscoveryParticipantInfo diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp index 75f1747f872..7b90a5ce3da 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp @@ -398,7 +398,7 @@ class DiscoveryDataBase void match_new_server_( eprosima::fastdds::rtps::GuidPrefix_t& participant_prefix, - bool is_client_or_super_client); + bool is_super_client); void create_virtual_endpoints_( eprosima::fastdds::rtps::GuidPrefix_t& participant_prefix); diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp index a1e611eb874..703efbc49a7 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp @@ -47,10 +47,8 @@ class DiscoveryParticipantChangeData DiscoveryParticipantChangeData( RemoteLocatorList metatraffic_locators, - bool is_client, bool is_local) : metatraffic_locators_(metatraffic_locators) - , is_client_(is_client) , is_superclient_(false) , is_local_(is_local) { @@ -58,21 +56,14 @@ class DiscoveryParticipantChangeData DiscoveryParticipantChangeData( RemoteLocatorList metatraffic_locators, - bool is_client, bool is_local, bool is_superclient) : metatraffic_locators_(metatraffic_locators) - , is_client_(is_client) , is_superclient_(is_superclient) , is_local_(is_local) { } - bool is_client() const - { - return is_client_; - } - bool is_superclient() const { return is_superclient_; @@ -91,7 +82,6 @@ class DiscoveryParticipantChangeData void to_json( nlohmann::json& j) const { - j["is_client"] = is_client_; j["is_superclient"] = is_superclient_; j["is_local"] = is_local_; j["metatraffic_locators"] = object_to_string(metatraffic_locators_); @@ -101,10 +91,6 @@ class DiscoveryParticipantChangeData // The metatraffic locators of from the serialized payload RemoteLocatorList metatraffic_locators_; - // Whether this participant is a CLIENT or a SERVER/BACKUP/SUPER_CLIENT - // This variable affects the discovery filter to applied to each entity: - // false => send all data ; true => send only data that is required to match endpoints - bool is_client_ = false; // Wether this participant is a SUPER_CLIENT and needs special treatment // when matching remote endpoints bool is_superclient_ = false; diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantInfo.hpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantInfo.hpp index 2b92388e89e..23e65f295fa 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantInfo.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantInfo.hpp @@ -90,11 +90,6 @@ class DiscoveryParticipantInfo : public DiscoverySharedInfo void remove_writer( const GUID_t& guid); - bool is_client() const - { - return participant_change_data_.is_client(); - } - bool is_superclient() const { return participant_change_data_.is_superclient(); diff --git a/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp b/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp index 42c8135faef..11ff88c511a 100644 --- a/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp +++ b/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp @@ -83,7 +83,6 @@ void from_json( : } "metatraffic_locators":{} - "is_client":, "is_local": } }, diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp index 07fc36e562e..9573fd6cc17 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp @@ -897,7 +897,7 @@ void PDPServer::announceParticipantState( // Update the database with our own data if (discovery_db().update( change, - ddb::DiscoveryParticipantChangeData(metatraffic_locators, false, true))) + ddb::DiscoveryParticipantChangeData(metatraffic_locators, true))) { // Distribute awake_routine_thread(); diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp index 23c42689201..cfa49d373cd 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp @@ -191,7 +191,6 @@ void PDPServerListener::on_new_cache_change_added( change.get(), ddb::DiscoveryParticipantChangeData( participant_data.metatraffic_locators, - false, is_local, is_client || participant_type_str == ParticipantType::SUPER_CLIENT))) { From 0aa0392ae9262192dbd7679a80f21f0e0a5d9924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Tue, 27 Jan 2026 16:42:06 +0100 Subject: [PATCH 13/18] Uncrustify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- .../discovery/database/backup/SharedBackupFunctions.hpp | 2 +- src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp b/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp index 11ff88c511a..fa05486638e 100644 --- a/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp +++ b/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp @@ -30,7 +30,7 @@ namespace ddb { using json = nlohmann::json; -template +template std::string object_to_string( const T& t) { diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp index 9573fd6cc17..43bae3c1772 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp @@ -927,7 +927,8 @@ void PDPServer::announceParticipantState( // but the routine thread has not consumed it yet. // This would happen when the routine thread is busy in initializing, i.e. it already has other // DATA(P) to parse before the own one is inserted by update. - EPROSIMA_LOG_WARNING(RTPS_PDP_SERVER, "Local Server DATA(p) uninitialized before local on announcement. " + EPROSIMA_LOG_WARNING(RTPS_PDP_SERVER, + "Local Server DATA(p) uninitialized before local on announcement. " << "It will be sent in next announce iteration."); return; } @@ -1255,7 +1256,8 @@ History::iterator PDPServer::process_change_acknowledgement( // Remove the entry from writer history, but do not release the cache. // This CacheChange will only be released in the case that is substituted by a DATA(Up|Uw|Ur). EPROSIMA_LOG_INFO(RTPS_PDP_SERVER, "Removing change " << c->instanceHandle - << " from history as it has been acked for everyone"); + << + " from history as it has been acked for everyone"); return writer_history->remove_change(cit, false); } } From e1e58eb0d625428a845f1dde2f1d99f967d39f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Tue, 27 Jan 2026 16:44:39 +0100 Subject: [PATCH 14/18] More uncrustify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp index 43bae3c1772..699e24668e9 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp @@ -1257,7 +1257,7 @@ History::iterator PDPServer::process_change_acknowledgement( // This CacheChange will only be released in the case that is substituted by a DATA(Up|Uw|Ur). EPROSIMA_LOG_INFO(RTPS_PDP_SERVER, "Removing change " << c->instanceHandle << - " from history as it has been acked for everyone"); + " from history as it has been acked for everyone"); return writer_history->remove_change(cit, false); } } From 05bba9616a95920e2a23dc862fd1019a78f1fa3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Wed, 28 Jan 2026 09:23:59 +0100 Subject: [PATCH 15/18] Rename internal super_client to client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- src/cpp/rtps/builtin/BuiltinProtocols.cpp | 2 +- .../discovery/database/DiscoveryDataBase.cpp | 19 ++++++------- .../discovery/database/DiscoveryDataBase.hpp | 2 +- .../DiscoveryParticipantChangeData.hpp | 27 +++++++------------ .../database/DiscoveryParticipantInfo.hpp | 4 +-- .../database/backup/SharedBackupFunctions.hpp | 1 + .../discovery/participant/PDPClient.cpp | 4 +-- .../builtin/discovery/participant/PDPClient.h | 6 +---- .../discovery/participant/PDPServer.cpp | 2 +- .../participant/PDPServerListener.cpp | 4 +-- 10 files changed, 30 insertions(+), 41 deletions(-) diff --git a/src/cpp/rtps/builtin/BuiltinProtocols.cpp b/src/cpp/rtps/builtin/BuiltinProtocols.cpp index 9fe7d870bdc..ae203a44cab 100644 --- a/src/cpp/rtps/builtin/BuiltinProtocols.cpp +++ b/src/cpp/rtps/builtin/BuiltinProtocols.cpp @@ -119,7 +119,7 @@ bool BuiltinProtocols::initBuiltinProtocols( #endif // if HAVE_SQLITE3 case DiscoveryProtocol::SUPER_CLIENT: - mp_PDP = new fastdds::rtps::PDPClient(this, allocation, true); + mp_PDP = new fastdds::rtps::PDPClient(this, allocation); break; default: diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp index eeabaa10671..5cb5c51aaa3 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp @@ -604,7 +604,7 @@ void DiscoveryDataBase::create_participant_from_change_( void DiscoveryDataBase::match_new_server_( eprosima::fastdds::rtps::GuidPrefix_t& participant_prefix, - bool is_super_client) + bool is_client) { // Send Our DATA(p) to the new participant. // If this is not done, our data could be skipped afterwards because of a gap sent in newer DATA(p)s, @@ -613,7 +613,7 @@ void DiscoveryDataBase::match_new_server_( assert(our_data_it != participants_.end()); add_pdp_to_send_(our_data_it->second.change()); - if (!is_super_client) + if (!is_client) { // To obtain a mesh topology with servers, we need to: // - Make all known servers relevant to the new server @@ -622,7 +622,7 @@ void DiscoveryDataBase::match_new_server_( // - Send Data(p) of the new server to all other servers for (auto& part : participants_) { - if (part.first != server_guid_prefix_ && !part.second.is_superclient()) + if (part.first != server_guid_prefix_ && !part.second.is_client()) { if (part.first == participant_prefix) { @@ -722,7 +722,7 @@ bool DiscoveryDataBase::participant_data_has_changed_( const DiscoveryParticipantChangeData& new_change_data) { return !(participant_info.is_local() == new_change_data.is_local() && - participant_info.is_superclient() == new_change_data.is_superclient()); + participant_info.is_client() == new_change_data.is_client()); } void DiscoveryDataBase::create_new_participant_from_change_( @@ -764,7 +764,7 @@ void DiscoveryDataBase::create_new_participant_from_change_( if (change_guid.guidPrefix != server_guid_prefix_ && ret.first->second.is_local()) { // Match new server and create virtual endpoints - match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); + match_new_server_(change_guid.guidPrefix, change_data.is_client()); } } else @@ -802,12 +802,12 @@ void DiscoveryDataBase::update_participant_from_change_( update_change_and_unmatch_(ch, participant_info); // If it is local and server we have to create virtual endpoints, except for our own server - if (change_guid.guidPrefix != server_guid_prefix_ && !change_data.is_superclient() && change_data.is_local()) + if (change_guid.guidPrefix != server_guid_prefix_ && !change_data.is_client() && change_data.is_local()) { // Match new server and create virtual endpoints // NOTE: match after having updated the change, so virtual endpoints are not discarded for having // an associated unalive participant - match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); + match_new_server_(change_guid.guidPrefix, change_data.is_client()); } // Treat as a new participant found @@ -833,10 +833,10 @@ void DiscoveryDataBase::update_participant_from_change_( // If the participant changes to server local, virtual endpoints must be added // If it is local and server the only possibility is it was a remote server and it must be converted to local - if (!change_data.is_superclient()) + if (!change_data.is_client()) { // NOTE: match after having updated the change in order to send the new Data(P) - match_new_server_(change_guid.guidPrefix, change_data.is_superclient()); + match_new_server_(change_guid.guidPrefix, change_data.is_client()); } // Treat as a new participant found @@ -2466,6 +2466,7 @@ bool DiscoveryDataBase::from_json( // Populate DiscoveryParticipantChangeData DiscoveryParticipantChangeData dpcd( rll, + it.value()["is_client"].get(), it.value()["is_local"].get()); // Populate DiscoveryParticipantInfo diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp index 7b90a5ce3da..b978a57ab9d 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp @@ -398,7 +398,7 @@ class DiscoveryDataBase void match_new_server_( eprosima::fastdds::rtps::GuidPrefix_t& participant_prefix, - bool is_super_client); + bool is_client); void create_virtual_endpoints_( eprosima::fastdds::rtps::GuidPrefix_t& participant_prefix); diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp index 703efbc49a7..da30b9c6368 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp @@ -47,26 +47,17 @@ class DiscoveryParticipantChangeData DiscoveryParticipantChangeData( RemoteLocatorList metatraffic_locators, + bool is_client, bool is_local) : metatraffic_locators_(metatraffic_locators) - , is_superclient_(false) + , is_client_(is_client) , is_local_(is_local) { } - DiscoveryParticipantChangeData( - RemoteLocatorList metatraffic_locators, - bool is_local, - bool is_superclient) - : metatraffic_locators_(metatraffic_locators) - , is_superclient_(is_superclient) - , is_local_(is_local) - { - } - - bool is_superclient() const + bool is_client() const { - return is_superclient_; + return is_client_; } bool is_local() const @@ -82,7 +73,7 @@ class DiscoveryParticipantChangeData void to_json( nlohmann::json& j) const { - j["is_superclient"] = is_superclient_; + j["is_client"] = is_client_; j["is_local"] = is_local_; j["metatraffic_locators"] = object_to_string(metatraffic_locators_); } @@ -91,9 +82,11 @@ class DiscoveryParticipantChangeData // The metatraffic locators of from the serialized payload RemoteLocatorList metatraffic_locators_; - // Wether this participant is a SUPER_CLIENT and needs special treatment - // when matching remote endpoints - bool is_superclient_ = false; + // Whether this participant is a CLIENT/SUPER_CLIENT or a SERVER/BACKUP + // This variable affects the discovery filter to applied to each entity: + // false => send all data ; true => send all data but needs special + // treatment when matching remote endpoints + bool is_client_ = false; // Whether this participant (CLIENT OR SERVER) is a client of this server bool is_local_ = false; }; diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantInfo.hpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantInfo.hpp index 23e65f295fa..c0a6bf60dbb 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantInfo.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantInfo.hpp @@ -90,9 +90,9 @@ class DiscoveryParticipantInfo : public DiscoverySharedInfo void remove_writer( const GUID_t& guid); - bool is_superclient() const + bool is_client() const { - return participant_change_data_.is_superclient(); + return participant_change_data_.is_client(); } bool is_local() const diff --git a/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp b/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp index fa05486638e..4754d935b1a 100644 --- a/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp +++ b/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp @@ -83,6 +83,7 @@ void from_json( : } "metatraffic_locators":{} + "is_client":, "is_local": } }, diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp index a32f33aac46..e6c113dccb7 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp @@ -84,12 +84,10 @@ static void direct_send( PDPClient::PDPClient( BuiltinProtocols* builtin, - const RTPSParticipantAllocationAttributes& allocation, - bool super_client) + const RTPSParticipantAllocationAttributes& allocation) : PDP(builtin, allocation) , mp_sync(nullptr) , _serverPing(false) - , _super_client(super_client) { } diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPClient.h b/src/cpp/rtps/builtin/discovery/participant/PDPClient.h index 7a81fb93ee8..e315732ee06 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPClient.h +++ b/src/cpp/rtps/builtin/discovery/participant/PDPClient.h @@ -52,8 +52,7 @@ class PDPClient : public PDP */ PDPClient( BuiltinProtocols* builtin, - const RTPSParticipantAllocationAttributes& allocation, - bool super_client = false); + const RTPSParticipantAllocationAttributes& allocation); ~PDPClient(); void initializeParticipantProxyData( @@ -272,9 +271,6 @@ class PDPClient : public PDP //! flag to hightlight we need a server ping announcement bool _serverPing; - //! flag to know this client must use super client participant type - bool _super_client; - //! List of real connected servers std::list connected_servers_; }; diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp index 699e24668e9..990590ae583 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp @@ -897,7 +897,7 @@ void PDPServer::announceParticipantState( // Update the database with our own data if (discovery_db().update( change, - ddb::DiscoveryParticipantChangeData(metatraffic_locators, true))) + ddb::DiscoveryParticipantChangeData(metatraffic_locators, false, true))) { // Distribute awake_routine_thread(); diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp index cfa49d373cd..ea9b75799b8 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp @@ -191,8 +191,8 @@ void PDPServerListener::on_new_cache_change_added( change.get(), ddb::DiscoveryParticipantChangeData( participant_data.metatraffic_locators, - is_local, - is_client || participant_type_str == ParticipantType::SUPER_CLIENT))) + is_client || participant_type_str == ParticipantType::SUPER_CLIENT, + is_local))) { // Remove change from PDP reader history, but do not return it to the pool. From here on, the discovery // database takes ownership of the CacheChange_t. Henceforth there are no references to the change. From 6b7cee21a2be196420d5ec133a7a3fe334e38c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Thu, 29 Jan 2026 09:24:16 +0100 Subject: [PATCH 16/18] Apply revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- src/cpp/rtps/builtin/BuiltinProtocols.cpp | 5 +---- .../discovery/database/DiscoveryParticipantChangeData.hpp | 3 ++- src/cpp/rtps/builtin/discovery/participant/PDP.cpp | 7 ++++++- .../builtin/discovery/participant/PDPServerListener.cpp | 7 +++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/cpp/rtps/builtin/BuiltinProtocols.cpp b/src/cpp/rtps/builtin/BuiltinProtocols.cpp index ae203a44cab..dace9dd81ad 100644 --- a/src/cpp/rtps/builtin/BuiltinProtocols.cpp +++ b/src/cpp/rtps/builtin/BuiltinProtocols.cpp @@ -104,6 +104,7 @@ bool BuiltinProtocols::initBuiltinProtocols( return false; case DiscoveryProtocol::CLIENT: + case DiscoveryProtocol::SUPER_CLIENT: mp_PDP = new fastdds::rtps::PDPClient(this, allocation); break; @@ -118,10 +119,6 @@ bool BuiltinProtocols::initBuiltinProtocols( break; #endif // if HAVE_SQLITE3 - case DiscoveryProtocol::SUPER_CLIENT: - mp_PDP = new fastdds::rtps::PDPClient(this, allocation); - break; - default: EPROSIMA_LOG_ERROR(RTPS_PDP, "Unknown DiscoveryProtocol specified."); return false; diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp index da30b9c6368..b30af494877 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp @@ -73,7 +73,8 @@ class DiscoveryParticipantChangeData void to_json( nlohmann::json& j) const { - j["is_client"] = is_client_; + j["is_client"] = false; + j["is_superclient"] = is_client_; j["is_local"] = is_local_; j["metatraffic_locators"] = object_to_string(metatraffic_locators_); } diff --git a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp index 3ebf4cbfbe0..56ee9e95850 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp @@ -1526,7 +1526,12 @@ void PDP::set_external_participant_properties_( // Set participant type property // TODO: This could be done somewhere else that makes more sense. std::stringstream participant_type; - participant_type << part_attributes.builtin.discovery_config.discoveryProtocol; + if (part_attributes.builtin.discovery_config.discoveryProtocol == DiscoveryProtocol::CLIENT) { + // Announce CLIENT as SUPER_CLIENT for backwards compatibility + participant_type << DiscoveryProtocol::SUPER_CLIENT; + } else { + participant_type << part_attributes.builtin.discovery_config.discoveryProtocol; + } auto ptype = participant_type.str(); participant_data->properties.push_back(fastdds::dds::parameter_property_participant_type, ptype); diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp index ea9b75799b8..d8bafd4f2fa 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp @@ -191,7 +191,7 @@ void PDPServerListener::on_new_cache_change_added( change.get(), ddb::DiscoveryParticipantChangeData( participant_data.metatraffic_locators, - is_client || participant_type_str == ParticipantType::SUPER_CLIENT, + is_client, is_local))) { // Remove change from PDP reader history, but do not return it to the pool. From here on, the discovery @@ -255,7 +255,7 @@ void PDPServerListener::on_new_cache_change_added( // All local builtins are connected, the database will avoid any EDP DATA to be send before having PDP // DATA acknowledgement. Non-local SERVERs will also be connected - if (pdata && (is_local || (!is_client && participant_type_str != ParticipantType::SUPER_CLIENT))) + if (pdata && (is_local || !is_client)) { pdp_server()->assignRemoteEndpoints(pdata); } @@ -419,8 +419,7 @@ std::pair PDPServerListener::check_server_discovery_conditions( participant_type_str = parent_pdp_->check_participant_type(properties); if (participant_type_str == ParticipantType::SERVER || - participant_type_str == ParticipantType::BACKUP || - participant_type_str == ParticipantType::SUPER_CLIENT) + participant_type_str == ParticipantType::BACKUP) { ret.second = false; } From dd4dd5a25fc81ae95facd2aa07e6499490e432ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Thu, 29 Jan 2026 09:24:57 +0100 Subject: [PATCH 17/18] Uncrustify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- src/cpp/rtps/builtin/discovery/participant/PDP.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp index 56ee9e95850..0b354611250 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp @@ -1526,10 +1526,13 @@ void PDP::set_external_participant_properties_( // Set participant type property // TODO: This could be done somewhere else that makes more sense. std::stringstream participant_type; - if (part_attributes.builtin.discovery_config.discoveryProtocol == DiscoveryProtocol::CLIENT) { + if (part_attributes.builtin.discovery_config.discoveryProtocol == DiscoveryProtocol::CLIENT) + { // Announce CLIENT as SUPER_CLIENT for backwards compatibility participant_type << DiscoveryProtocol::SUPER_CLIENT; - } else { + } + else + { participant_type << part_attributes.builtin.discovery_config.discoveryProtocol; } auto ptype = participant_type.str(); From 09d729417b4fe454e5850638cfcad9a8dc3c087b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl?= Date: Thu, 29 Jan 2026 10:23:04 +0100 Subject: [PATCH 18/18] Fix check_server_discovery_conditions wrong participant bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raül --- .../rtps/builtin/discovery/participant/PDPServerListener.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp index d8bafd4f2fa..e4105d1c93b 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp @@ -429,7 +429,8 @@ std::pair PDPServerListener::check_server_discovery_conditions( << participant_type_str); ret.first = false; } - else if (participant_type_str != ParticipantType::CLIENT) + else if (participant_type_str != ParticipantType::CLIENT && + participant_type_str != ParticipantType::SUPER_CLIENT) { EPROSIMA_LOG_ERROR(RTPS_PDP_LISTENER, "Wrong " << dds::parameter_property_participant_type << ": " << participant_type_str);