From edb4b4509262a07f7698d1401bf15eae82a6810e Mon Sep 17 00:00:00 2001 From: Shane Loretz Date: Fri, 7 Apr 2023 12:30:36 -0700 Subject: [PATCH 1/4] Pick smallest available participant ID for new paricipants (#3437) * Pick smallest available participant ID for new paricipants Signed-off-by: Shane Loretz * Fix style issues Signed-off-by: Shane Loretz * Eliminate m_maxRTPSParticipantId Signed-off-by: Shane Loretz * Clearer comments on rationale behind return value Signed-off-by: Shane Loretz * static_cast to avoid warning on WIN32 Signed-off-by: Shane Loretz * Use special participant id value for prefix creation. Signed-off-by: Miguel Company * New reservation mechanism Signed-off-by: Miguel Company --------- Signed-off-by: Shane Loretz Signed-off-by: Miguel Company Co-authored-by: Miguel Company (cherry picked from commit e46e87550640713c36f71d96e57b37adca749907) # Conflicts: # src/cpp/rtps/RTPSDomain.cpp # src/cpp/rtps/RTPSDomainImpl.hpp --- src/cpp/rtps/RTPSDomain.cpp | 95 ++++++++++++++++++++++++ src/cpp/rtps/RTPSDomainImpl.hpp | 123 ++++++++++++++++++++++++++++++++ 2 files changed, 218 insertions(+) diff --git a/src/cpp/rtps/RTPSDomain.cpp b/src/cpp/rtps/RTPSDomain.cpp index 341c7091206..1eeb85aaa04 100644 --- a/src/cpp/rtps/RTPSDomain.cpp +++ b/src/cpp/rtps/RTPSDomain.cpp @@ -129,7 +129,9 @@ RTPSParticipant* RTPSDomain::createParticipant( } uint32_t ID; + if (!instance->prepare_participant_id(PParam.participantID, ID)) { +<<<<<<< HEAD std::lock_guard guard(m_mutex); if (PParam.participantID < 0) @@ -149,6 +151,9 @@ RTPSParticipant* RTPSDomain::createParticipant( return nullptr; } } +======= + return nullptr; +>>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) } if (!PParam.defaultUnicastLocatorList.isValid()) @@ -166,7 +171,21 @@ RTPSParticipant* RTPSDomain::createParticipant( // Generate a new GuidPrefix_t GuidPrefix_t guidP; +<<<<<<< HEAD guid_prefix_create(ID, guidP); +======= + guid_prefix_create(instance->get_id_for_prefix(ID), guidP); + if (!PParam.builtin.metatraffic_external_unicast_locators.empty()) + { + fastdds::rtps::LocatorList locators; + fastrtps::rtps::IPFinder::getIP4Address(&locators); + fastdds::rtps::ExternalLocatorsProcessor::add_external_locators(locators, + PParam.builtin.metatraffic_external_unicast_locators); + uint16_t host_id = Host::compute_id(locators); + guidP.value[2] = static_cast(host_id & 0xFF); + guidP.value[3] = static_cast((host_id >> 8) & 0xFF); + } +>>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) RTPSParticipant* p = new RTPSParticipant(nullptr); RTPSParticipantImpl* pimpl = nullptr; @@ -222,8 +241,15 @@ RTPSParticipant* RTPSDomain::createParticipant( } { +<<<<<<< HEAD std::lock_guard guard(m_mutex); m_RTPSParticipants.push_back(t_p_RTPSParticipant(p, pimpl)); +======= + std::lock_guard guard(instance->m_mutex); + instance->m_RTPSParticipants.push_back(t_p_RTPSParticipant(p, pimpl)); + instance->m_RTPSParticipantIDs[ID].used = true; + instance->m_RTPSParticipantIDs[ID].reserved = true; +>>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) } // Check the environment file in case it was modified during participant creation leading to a missed callback. @@ -254,9 +280,17 @@ bool RTPSDomain::removeRTPSParticipant( { if (it->second->getGuid().guidPrefix == p->getGuid().guidPrefix) { +<<<<<<< HEAD RTPSDomain::t_p_RTPSParticipant participant = *it; m_RTPSParticipants.erase(it); m_RTPSParticipantIDs.erase(m_RTPSParticipantIDs.find(participant.second->getRTPSParticipantID())); +======= + RTPSDomainImpl::t_p_RTPSParticipant participant = *it; + instance->m_RTPSParticipants.erase(it); + uint32_t participant_id = participant.second->getRTPSParticipantID(); + instance->m_RTPSParticipantIDs[participant_id].used = false; + instance->m_RTPSParticipantIDs[participant_id].reserved = false; +>>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) lock.unlock(); removeRTPSParticipant_nts(participant); return true; @@ -547,17 +581,78 @@ RTPSParticipant* RTPSDomain::clientServerEnvironmentCreationOverride( return nullptr; } +<<<<<<< HEAD +======= +uint32_t RTPSDomainImpl::getNewId() +{ + // Get the smallest available participant ID. + // Settings like maxInitialPeersRange control how many participants a peer + // will look for on this host. + // Choosing the smallest value ensures peers using unicast discovery will + // find this participant as long as the total number of participants has + // not exceeded the number of peers they will look for. + uint32_t i = 0; + while (m_RTPSParticipantIDs[i].reserved || m_RTPSParticipantIDs[i].used) + { + ++i; + } + m_RTPSParticipantIDs[i].reserved = true; + return i; +} + +bool RTPSDomainImpl::prepare_participant_id( + int32_t input_id, + uint32_t& participant_id) +{ + std::lock_guard guard(m_mutex); + if (input_id < 0) + { + participant_id = getNewId(); + } + else + { + participant_id = input_id; + if (m_RTPSParticipantIDs[participant_id].used == true) + { + EPROSIMA_LOG_ERROR(RTPS_PARTICIPANT, "RTPSParticipant with the same ID already exists"); + return false; + } + } + return true; +} + +uint32_t RTPSDomainImpl::get_id_for_prefix( + uint32_t participant_id) +{ + uint32_t ret = participant_id; + if (ret < 0x10000) + { + std::lock_guard guard(m_mutex); + ret |= m_RTPSParticipantIDs[participant_id].counter; + m_RTPSParticipantIDs[participant_id].counter += 0x10000; + } + + return ret; +} + +>>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) void RTPSDomainImpl::create_participant_guid( int32_t& participant_id, GUID_t& guid) { if (participant_id < 0) { +<<<<<<< HEAD std::lock_guard guard(RTPSDomain::m_mutex); do { participant_id = RTPSDomain::getNewId(); } while (RTPSDomain::m_RTPSParticipantIDs.find(participant_id) != RTPSDomain::m_RTPSParticipantIDs.end()); +======= + auto instance = get_instance(); + std::lock_guard guard(instance->m_mutex); + participant_id = instance->getNewId(); +>>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) } guid_prefix_create(participant_id, guid.guidPrefix); diff --git a/src/cpp/rtps/RTPSDomainImpl.hpp b/src/cpp/rtps/RTPSDomainImpl.hpp index 434a1f2ffda..81e7d8f55b2 100644 --- a/src/cpp/rtps/RTPSDomainImpl.hpp +++ b/src/cpp/rtps/RTPSDomainImpl.hpp @@ -18,6 +18,7 @@ #include #include +#include #if defined(_WIN32) || defined(__unix__) #include @@ -41,6 +42,86 @@ class RTPSDomainImpl { public: +<<<<<<< HEAD +======= + typedef std::pair t_p_RTPSParticipant; + + /** + * Get singleton instance. + * + * @return Shared pointer to RTPSDomainImpl singleton instance. + */ + static std::shared_ptr get_instance(); + + /** + * Method to shut down all RTPSParticipants, readers, writers, etc. + * It must be called at the end of the process to avoid memory leaks. + * It also shut downs the DomainRTPSParticipant. + * + * \post After this call, all the pointers to RTPS entities are invalidated and their use may + * result in undefined behaviour. + */ + static void stopAll(); + + /** + * @brief Create a RTPSParticipant. + * @param domain_id DomainId to be used by the RTPSParticipant (80 by default). + * @param enabled True if the RTPSParticipant should be enabled on creation. False if it will be enabled later with RTPSParticipant::enable() + * @param attrs RTPSParticipant Attributes. + * @param plisten Pointer to the ParticipantListener. + * @return Pointer to the RTPSParticipant. + * + * \warning The returned pointer is invalidated after a call to removeRTPSParticipant() or stopAll(), + * so its use may result in undefined behaviour. + */ + static RTPSParticipant* createParticipant( + uint32_t domain_id, + bool enabled, + const RTPSParticipantAttributes& attrs, + RTPSParticipantListener* plisten); + + /** + * Remove a RTPSWriter. + * @param writer Pointer to the writer you want to remove. + * @return True if correctly removed. + */ + static bool removeRTPSWriter( + RTPSWriter* writer); + + /** + * Remove a RTPSReader. + * @param reader Pointer to the reader you want to remove. + * @return True if correctly removed. + */ + static bool removeRTPSReader( + RTPSReader* reader); + + /** + * Remove a RTPSParticipant and delete all its associated Writers, Readers, resources, etc. + * @param[in] p Pointer to the RTPSParticipant; + * @return True if correct. + */ + static bool removeRTPSParticipant( + RTPSParticipant* p); + + /** + * Creates a RTPSParticipant as default server or client if ROS_MASTER_URI environment variable is set. + * @param domain_id DDS domain associated + * @param enabled True if the RTPSParticipant should be enabled on creation. False if it will be enabled later with RTPSParticipant::enable() + * @param attrs RTPSParticipant Attributes. + * @param listen Pointer to the ParticipantListener. + * @return Pointer to the RTPSParticipant. + * + * \warning The returned pointer is invalidated after a call to removeRTPSParticipant() or stopAll(), + * so its use may result in undefined behaviour. + */ + static RTPSParticipant* clientServerEnvironmentCreationOverride( + uint32_t domain_id, + bool enabled, + const RTPSParticipantAttributes& attrs, + RTPSParticipantListener* listen /*= nullptr*/); + +>>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) /** * Create a RTPSWriter in a participant. * @param p Pointer to the RTPSParticipant. @@ -145,7 +226,49 @@ class RTPSDomainImpl */ static void file_watch_callback(); +<<<<<<< HEAD static FileWatchHandle file_watch_handle_; +======= +private: + + /** + * @brief Get Id to create a RTPSParticipant. + * + * This function assumes m_mutex is already locked by the caller. + * + * @return Different ID for each call. + */ + uint32_t getNewId(); + + bool prepare_participant_id( + int32_t input_id, + uint32_t& participant_id); + + uint32_t get_id_for_prefix( + uint32_t participant_id); + + void removeRTPSParticipant_nts( + t_p_RTPSParticipant&); + + std::shared_ptr boost_singleton_handler_ { eprosima::detail:: + BoostAtExitRegistry:: + get_instance() }; + + std::mutex m_mutex; + + std::vector m_RTPSParticipants; + + struct ParticipantIDState + { + uint32_t counter = 0; + bool reserved = false; + bool used = false; + }; + + std::unordered_map m_RTPSParticipantIDs; + + FileWatchHandle file_watch_handle_; +>>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) }; } // namespace rtps From 297de6881566ce2df07efbf2df62bb3932b297da Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Wed, 13 Mar 2024 16:28:16 +0100 Subject: [PATCH 2/4] Refs #20120: Solve conflicts Signed-off-by: Jesus Perez --- src/cpp/rtps/RTPSDomain.cpp | 85 ++++---------------------- src/cpp/rtps/RTPSDomainImpl.hpp | 105 ++------------------------------ 2 files changed, 17 insertions(+), 173 deletions(-) diff --git a/src/cpp/rtps/RTPSDomain.cpp b/src/cpp/rtps/RTPSDomain.cpp index 1eeb85aaa04..9a061105bc0 100644 --- a/src/cpp/rtps/RTPSDomain.cpp +++ b/src/cpp/rtps/RTPSDomain.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -61,7 +62,7 @@ static void guid_prefix_create( std::mutex RTPSDomain::m_mutex; std::atomic RTPSDomain::m_maxRTPSParticipantID(1); std::vector RTPSDomain::m_RTPSParticipants; -std::set RTPSDomain::m_RTPSParticipantIDs; +std::unordered_map RTPSDomainImpl::m_RTPSParticipantIDs; FileWatchHandle RTPSDomainImpl::file_watch_handle_; void RTPSDomain::stopAll() @@ -75,7 +76,7 @@ void RTPSDomain::stopAll() while (m_RTPSParticipants.size() > 0) { RTPSDomain::t_p_RTPSParticipant participant = m_RTPSParticipants.back(); - m_RTPSParticipantIDs.erase(m_RTPSParticipantIDs.find(participant.second->getRTPSParticipantID())); + RTPSDomainImpl::m_RTPSParticipantIDs.erase(RTPSDomainImpl::m_RTPSParticipantIDs.find(participant.second->getRTPSParticipantID())); m_RTPSParticipants.pop_back(); lock.unlock(); @@ -129,31 +130,9 @@ RTPSParticipant* RTPSDomain::createParticipant( } uint32_t ID; - if (!instance->prepare_participant_id(PParam.participantID, ID)) + if (!RTPSDomainImpl::prepare_participant_id(PParam.participantID, ID)) { -<<<<<<< HEAD - std::lock_guard guard(m_mutex); - - if (PParam.participantID < 0) - { - ID = getNewId(); - while (m_RTPSParticipantIDs.insert(ID).second == false) - { - ID = getNewId(); - } - } - else - { - ID = PParam.participantID; - if (m_RTPSParticipantIDs.insert(ID).second == false) - { - logError(RTPS_PARTICIPANT, "RTPSParticipant with the same ID already exists"); - return nullptr; - } - } -======= return nullptr; ->>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) } if (!PParam.defaultUnicastLocatorList.isValid()) @@ -171,21 +150,7 @@ RTPSParticipant* RTPSDomain::createParticipant( // Generate a new GuidPrefix_t GuidPrefix_t guidP; -<<<<<<< HEAD - guid_prefix_create(ID, guidP); -======= - guid_prefix_create(instance->get_id_for_prefix(ID), guidP); - if (!PParam.builtin.metatraffic_external_unicast_locators.empty()) - { - fastdds::rtps::LocatorList locators; - fastrtps::rtps::IPFinder::getIP4Address(&locators); - fastdds::rtps::ExternalLocatorsProcessor::add_external_locators(locators, - PParam.builtin.metatraffic_external_unicast_locators); - uint16_t host_id = Host::compute_id(locators); - guidP.value[2] = static_cast(host_id & 0xFF); - guidP.value[3] = static_cast((host_id >> 8) & 0xFF); - } ->>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) + guid_prefix_create(RTPSDomainImpl::get_id_for_prefix(ID), guidP); RTPSParticipant* p = new RTPSParticipant(nullptr); RTPSParticipantImpl* pimpl = nullptr; @@ -241,15 +206,10 @@ RTPSParticipant* RTPSDomain::createParticipant( } { -<<<<<<< HEAD std::lock_guard guard(m_mutex); m_RTPSParticipants.push_back(t_p_RTPSParticipant(p, pimpl)); -======= - std::lock_guard guard(instance->m_mutex); - instance->m_RTPSParticipants.push_back(t_p_RTPSParticipant(p, pimpl)); - instance->m_RTPSParticipantIDs[ID].used = true; - instance->m_RTPSParticipantIDs[ID].reserved = true; ->>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) + RTPSDomainImpl::m_RTPSParticipantIDs[ID].used = true; + RTPSDomainImpl::m_RTPSParticipantIDs[ID].reserved = true; } // Check the environment file in case it was modified during participant creation leading to a missed callback. @@ -280,20 +240,13 @@ bool RTPSDomain::removeRTPSParticipant( { if (it->second->getGuid().guidPrefix == p->getGuid().guidPrefix) { -<<<<<<< HEAD RTPSDomain::t_p_RTPSParticipant participant = *it; m_RTPSParticipants.erase(it); - m_RTPSParticipantIDs.erase(m_RTPSParticipantIDs.find(participant.second->getRTPSParticipantID())); -======= - RTPSDomainImpl::t_p_RTPSParticipant participant = *it; - instance->m_RTPSParticipants.erase(it); uint32_t participant_id = participant.second->getRTPSParticipantID(); - instance->m_RTPSParticipantIDs[participant_id].used = false; - instance->m_RTPSParticipantIDs[participant_id].reserved = false; ->>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) + RTPSDomainImpl::m_RTPSParticipantIDs[participant_id].used = false; + RTPSDomainImpl::m_RTPSParticipantIDs[participant_id].reserved = false; lock.unlock(); removeRTPSParticipant_nts(participant); - return true; } } } @@ -581,8 +534,6 @@ RTPSParticipant* RTPSDomain::clientServerEnvironmentCreationOverride( return nullptr; } -<<<<<<< HEAD -======= uint32_t RTPSDomainImpl::getNewId() { // Get the smallest available participant ID. @@ -604,7 +555,7 @@ bool RTPSDomainImpl::prepare_participant_id( int32_t input_id, uint32_t& participant_id) { - std::lock_guard guard(m_mutex); + std::lock_guard guard(RTPSDomain::m_mutex); if (input_id < 0) { participant_id = getNewId(); @@ -614,7 +565,7 @@ bool RTPSDomainImpl::prepare_participant_id( participant_id = input_id; if (m_RTPSParticipantIDs[participant_id].used == true) { - EPROSIMA_LOG_ERROR(RTPS_PARTICIPANT, "RTPSParticipant with the same ID already exists"); + logError(RTPS_PARTICIPANT, "RTPSParticipant with the same ID already exists"); return false; } } @@ -627,7 +578,7 @@ uint32_t RTPSDomainImpl::get_id_for_prefix( uint32_t ret = participant_id; if (ret < 0x10000) { - std::lock_guard guard(m_mutex); + std::lock_guard guard(RTPSDomain::m_mutex); ret |= m_RTPSParticipantIDs[participant_id].counter; m_RTPSParticipantIDs[participant_id].counter += 0x10000; } @@ -635,24 +586,14 @@ uint32_t RTPSDomainImpl::get_id_for_prefix( return ret; } ->>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) void RTPSDomainImpl::create_participant_guid( int32_t& participant_id, GUID_t& guid) { if (participant_id < 0) { -<<<<<<< HEAD std::lock_guard guard(RTPSDomain::m_mutex); - do - { - participant_id = RTPSDomain::getNewId(); - } while (RTPSDomain::m_RTPSParticipantIDs.find(participant_id) != RTPSDomain::m_RTPSParticipantIDs.end()); -======= - auto instance = get_instance(); - std::lock_guard guard(instance->m_mutex); - participant_id = instance->getNewId(); ->>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) + participant_id = getNewId(); } guid_prefix_create(participant_id, guid.guidPrefix); diff --git a/src/cpp/rtps/RTPSDomainImpl.hpp b/src/cpp/rtps/RTPSDomainImpl.hpp index 81e7d8f55b2..07a5bca88e7 100644 --- a/src/cpp/rtps/RTPSDomainImpl.hpp +++ b/src/cpp/rtps/RTPSDomainImpl.hpp @@ -42,86 +42,6 @@ class RTPSDomainImpl { public: -<<<<<<< HEAD -======= - typedef std::pair t_p_RTPSParticipant; - - /** - * Get singleton instance. - * - * @return Shared pointer to RTPSDomainImpl singleton instance. - */ - static std::shared_ptr get_instance(); - - /** - * Method to shut down all RTPSParticipants, readers, writers, etc. - * It must be called at the end of the process to avoid memory leaks. - * It also shut downs the DomainRTPSParticipant. - * - * \post After this call, all the pointers to RTPS entities are invalidated and their use may - * result in undefined behaviour. - */ - static void stopAll(); - - /** - * @brief Create a RTPSParticipant. - * @param domain_id DomainId to be used by the RTPSParticipant (80 by default). - * @param enabled True if the RTPSParticipant should be enabled on creation. False if it will be enabled later with RTPSParticipant::enable() - * @param attrs RTPSParticipant Attributes. - * @param plisten Pointer to the ParticipantListener. - * @return Pointer to the RTPSParticipant. - * - * \warning The returned pointer is invalidated after a call to removeRTPSParticipant() or stopAll(), - * so its use may result in undefined behaviour. - */ - static RTPSParticipant* createParticipant( - uint32_t domain_id, - bool enabled, - const RTPSParticipantAttributes& attrs, - RTPSParticipantListener* plisten); - - /** - * Remove a RTPSWriter. - * @param writer Pointer to the writer you want to remove. - * @return True if correctly removed. - */ - static bool removeRTPSWriter( - RTPSWriter* writer); - - /** - * Remove a RTPSReader. - * @param reader Pointer to the reader you want to remove. - * @return True if correctly removed. - */ - static bool removeRTPSReader( - RTPSReader* reader); - - /** - * Remove a RTPSParticipant and delete all its associated Writers, Readers, resources, etc. - * @param[in] p Pointer to the RTPSParticipant; - * @return True if correct. - */ - static bool removeRTPSParticipant( - RTPSParticipant* p); - - /** - * Creates a RTPSParticipant as default server or client if ROS_MASTER_URI environment variable is set. - * @param domain_id DDS domain associated - * @param enabled True if the RTPSParticipant should be enabled on creation. False if it will be enabled later with RTPSParticipant::enable() - * @param attrs RTPSParticipant Attributes. - * @param listen Pointer to the ParticipantListener. - * @return Pointer to the RTPSParticipant. - * - * \warning The returned pointer is invalidated after a call to removeRTPSParticipant() or stopAll(), - * so its use may result in undefined behaviour. - */ - static RTPSParticipant* clientServerEnvironmentCreationOverride( - uint32_t domain_id, - bool enabled, - const RTPSParticipantAttributes& attrs, - RTPSParticipantListener* listen /*= nullptr*/); - ->>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) /** * Create a RTPSWriter in a participant. * @param p Pointer to the RTPSParticipant. @@ -226,10 +146,7 @@ class RTPSDomainImpl */ static void file_watch_callback(); -<<<<<<< HEAD static FileWatchHandle file_watch_handle_; -======= -private: /** * @brief Get Id to create a RTPSParticipant. @@ -238,26 +155,15 @@ class RTPSDomainImpl * * @return Different ID for each call. */ - uint32_t getNewId(); + static uint32_t getNewId(); - bool prepare_participant_id( + static bool prepare_participant_id( int32_t input_id, uint32_t& participant_id); - uint32_t get_id_for_prefix( + static uint32_t get_id_for_prefix( uint32_t participant_id); - void removeRTPSParticipant_nts( - t_p_RTPSParticipant&); - - std::shared_ptr boost_singleton_handler_ { eprosima::detail:: - BoostAtExitRegistry:: - get_instance() }; - - std::mutex m_mutex; - - std::vector m_RTPSParticipants; - struct ParticipantIDState { uint32_t counter = 0; @@ -265,10 +171,7 @@ class RTPSDomainImpl bool used = false; }; - std::unordered_map m_RTPSParticipantIDs; - - FileWatchHandle file_watch_handle_; ->>>>>>> e46e87550 (Pick smallest available participant ID for new paricipants (#3437)) + static std::unordered_map m_RTPSParticipantIDs; }; } // namespace rtps From 973fc7dc4728526af296de14b9c573068f955e36 Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Wed, 13 Mar 2024 16:54:24 +0100 Subject: [PATCH 3/4] Refs #20120: Fix wrong deleted return Signed-off-by: Jesus Perez --- src/cpp/rtps/RTPSDomain.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpp/rtps/RTPSDomain.cpp b/src/cpp/rtps/RTPSDomain.cpp index 9a061105bc0..a38c71c7e40 100644 --- a/src/cpp/rtps/RTPSDomain.cpp +++ b/src/cpp/rtps/RTPSDomain.cpp @@ -247,6 +247,7 @@ bool RTPSDomain::removeRTPSParticipant( RTPSDomainImpl::m_RTPSParticipantIDs[participant_id].reserved = false; lock.unlock(); removeRTPSParticipant_nts(participant); + return true; } } } From ac46a634be56df3ebbceae89274f7dfb5dbcf5a1 Mon Sep 17 00:00:00 2001 From: Jesus Perez Date: Wed, 13 Mar 2024 16:56:17 +0100 Subject: [PATCH 4/4] Refs #20120: Uncrustify Signed-off-by: Jesus Perez --- src/cpp/rtps/RTPSDomain.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cpp/rtps/RTPSDomain.cpp b/src/cpp/rtps/RTPSDomain.cpp index a38c71c7e40..83ef60864d5 100644 --- a/src/cpp/rtps/RTPSDomain.cpp +++ b/src/cpp/rtps/RTPSDomain.cpp @@ -76,7 +76,8 @@ void RTPSDomain::stopAll() while (m_RTPSParticipants.size() > 0) { RTPSDomain::t_p_RTPSParticipant participant = m_RTPSParticipants.back(); - RTPSDomainImpl::m_RTPSParticipantIDs.erase(RTPSDomainImpl::m_RTPSParticipantIDs.find(participant.second->getRTPSParticipantID())); + RTPSDomainImpl::m_RTPSParticipantIDs.erase(RTPSDomainImpl::m_RTPSParticipantIDs.find(participant.second-> + getRTPSParticipantID())); m_RTPSParticipants.pop_back(); lock.unlock();