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 }} diff --git a/src/cpp/rtps/builtin/BuiltinProtocols.cpp b/src/cpp/rtps/builtin/BuiltinProtocols.cpp index 9fe7d870bdc..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, true); - break; - default: EPROSIMA_LOG_ERROR(RTPS_PDP, "Unknown DiscoveryProtocol specified."); return false; diff --git a/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp index 1f0c1908370..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_superclient) + 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_superclient) + 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_client() && !part.second.is_superclient()) + if (part.first != server_guid_prefix_ && !part.second.is_client()) { if (part.first == participant_prefix) { @@ -722,8 +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_client() == new_change_data.is_client() && - 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_( @@ -762,11 +761,10 @@ 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()); + match_new_server_(change_guid.guidPrefix, change_data.is_client()); } } else @@ -809,7 +807,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()); } // Treat as a new participant found @@ -838,7 +836,7 @@ void DiscoveryDataBase::update_participant_from_change_( 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 @@ -1199,114 +1197,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/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp b/src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp index ceeb1051cf3..b978a57ab9d 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) { } @@ -397,7 +398,7 @@ class DiscoveryDataBase void match_new_server_( eprosima::fastdds::rtps::GuidPrefix_t& participant_prefix, - bool is_superclient); + 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 a1e611eb874..b30af494877 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantChangeData.hpp @@ -51,19 +51,6 @@ class DiscoveryParticipantChangeData bool is_local) : metatraffic_locators_(metatraffic_locators) , is_client_(is_client) - , is_superclient_(false) - , is_local_(is_local) - { - } - - 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) { } @@ -73,11 +60,6 @@ class DiscoveryParticipantChangeData return is_client_; } - bool is_superclient() const - { - return is_superclient_; - } - bool is_local() const { return is_local_; @@ -91,8 +73,8 @@ class DiscoveryParticipantChangeData void to_json( nlohmann::json& j) const { - j["is_client"] = is_client_; - j["is_superclient"] = is_superclient_; + j["is_client"] = false; + j["is_superclient"] = is_client_; j["is_local"] = is_local_; j["metatraffic_locators"] = object_to_string(metatraffic_locators_); } @@ -101,13 +83,11 @@ 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 + // 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 only data that is required to match endpoints + // false => send all data ; true => send all data but needs special + // treatment when matching remote endpoints bool is_client_ = false; - // Wether this participant is a SUPER_CLIENT and needs special treatment - // when matching remote endpoints - bool is_superclient_ = 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 2b92388e89e..c0a6bf60dbb 100644 --- a/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantInfo.hpp +++ b/src/cpp/rtps/builtin/discovery/database/DiscoveryParticipantInfo.hpp @@ -95,11 +95,6 @@ class DiscoveryParticipantInfo : public DiscoverySharedInfo return participant_change_data_.is_client(); } - bool is_superclient() const - { - return participant_change_data_.is_superclient(); - } - bool is_local() const { return participant_change_data_.is_local(); diff --git a/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp b/src/cpp/rtps/builtin/discovery/database/backup/SharedBackupFunctions.hpp index 42c8135faef..4754d935b1a 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/PDP.cpp b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp index 3ebf4cbfbe0..0b354611250 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDP.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDP.cpp @@ -1526,7 +1526,15 @@ 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/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 07fc36e562e..990590ae583 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); } } diff --git a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp index a08795f82c7..e4105d1c93b 100644 --- a/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp +++ b/src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp @@ -192,8 +192,7 @@ void PDPServerListener::on_new_cache_change_added( ddb::DiscoveryParticipantChangeData( participant_data.metatraffic_locators, is_client, - is_local, - 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. @@ -256,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); } @@ -420,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; } @@ -431,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); diff --git a/test/blackbox/common/BlackboxTestsDiscovery.cpp b/test/blackbox/common/BlackboxTestsDiscovery.cpp index 063fed46a1f..47fca5b9354 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; @@ -1021,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, @@ -2173,7 +2175,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 +2187,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 +2199,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 diff --git a/test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp b/test/blackbox/common/DDSBlackboxTestsDSEasyMode.cpp index 6f19ac413a4..2b3b7b40e34 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 discover all the other participants (CLIENT) + 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: 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 --------------