Skip to content

Commit 1f2cf71

Browse files
Fix RTPSParticipantAttributes internal data races (#6370) (#6389)
* Fix RTPSParticipantAttributes internal data races (#6370) * Refs #23923: Take mutex in getter and env file callback Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com> * Refs #23923: Only update mutable attributes Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com> * Refs #23923: Copy attributes in getter Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com> * Refs #23923: Undo copy attributes Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com> * Refs #23923: Avoid calling get_attributes in SecurityManager constructor Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com> * Refs #23923: Copy attributes Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com> * Refs #23923: Protect missing cases Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Create new method to avoid API break Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Doxygen & TODO in next major Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Copy method in RTPSParticipant Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Mock and tests changes Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Revision Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Add missing mutable attribute Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Create const copy Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Uncrustify Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Spelling Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Split const and mutable RTPSParticipantAttributes Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Review - Fix Mutable & Constant attributes Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Review - Apply methods and composition of BuiltinAttributes Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Review - Update Tests Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Review - Add ConstantDiscoverySettings Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Solve using statement visibility Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Uncrustify Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Store constant attributes set at 'setup_' methods Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Init const attributes and update later Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Refs #23923: Review - Improve doxygen Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> --------- Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com> Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> Co-authored-by: Juan Lopez Fernandez <juanlopez@eprosima.com> (cherry picked from commit 7dd4b4d) # Conflicts: # include/fastdds/dds/publisher/DataWriter.hpp # include/fastdds/rtps/attributes/RTPSParticipantAttributes.h # include/fastdds/rtps/participant/RTPSParticipant.h # src/cpp/fastdds/builtin/type_lookup_service/TypeLookupManager.cpp # src/cpp/fastdds/builtin/type_lookup_service/TypeLookupReplyListener.cpp # src/cpp/fastdds/builtin/type_lookup_service/TypeLookupRequestListener.cpp # src/cpp/fastdds/domain/DomainParticipantImpl.cpp # src/cpp/rtps/builtin/BuiltinProtocols.cpp # src/cpp/rtps/builtin/discovery/endpoint/EDPSimple.cpp # src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp # src/cpp/rtps/builtin/discovery/participant/PDP.cpp # src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp # src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp # src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp # src/cpp/rtps/builtin/discovery/participant/PDPServerListener.cpp # src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp # src/cpp/rtps/builtin/discovery/participant/simple/PDPStatelessWriter.cpp # src/cpp/rtps/builtin/liveliness/WLP.cpp # src/cpp/rtps/flowcontrol/FlowControllerFactory.cpp # src/cpp/rtps/flowcontrol/FlowControllerImpl.hpp # src/cpp/rtps/participant/RTPSParticipantImpl.cpp # src/cpp/rtps/participant/RTPSParticipantImpl.h # src/cpp/rtps/reader/BaseReader.cpp # src/cpp/rtps/reader/StatefulReader.cpp # src/cpp/rtps/security/SecurityManager.cpp # test/mock/rtps/RTPSParticipant/fastdds/rtps/participant/RTPSParticipant.h # test/mock/rtps/RTPSParticipantAttributes/fastdds/rtps/attributes/RTPSParticipantAttributes.h # test/unittest/dds/participant/ParticipantTests.cpp * Solve conflicts Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Handle diffs between Fast 3 and Fast 2 Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Solve test conflicts in mocks Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Uncrustify Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> * Fix doxygen Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> --------- Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com> Co-authored-by: Carlos Ferreira González <carlosferreira@eprosima.com>
1 parent f76ca8a commit 1f2cf71

42 files changed

Lines changed: 3876 additions & 335 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

include/fastdds/rtps/attributes/RTPSParticipantAttributes.h

Lines changed: 546 additions & 3 deletions
Large diffs are not rendered by default.

include/fastdds/rtps/participant/RTPSParticipant.h

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,33 @@ class RTPS_DllAPI RTPSParticipant
211211
std::vector<std::string> getParticipantNames() const;
212212

213213
/**
214-
* Get a copy of the actual state of the RTPSParticipantParameters
215-
* @return RTPSParticipantAttributes copy of the params.
214+
* Get a reference of the current state of the RTPSParticipantAttributes.
215+
* @warning The returned reference is not thread safe. It is recommended to use copy_attributes()
216+
* instead to get a thread safe copy of the attributes.
217+
* @return RTPSParticipantAttributes reference.
216218
*/
217219
const RTPSParticipantAttributes& getRTPSParticipantAttributes() const;
218220

221+
/**
222+
* @brief Get a const reference of RTPSParticipantConstantAttributes of this RTPSParticipantImpl.
223+
* This method is thread safe because it returns a const reference to the internal constant attributes.
224+
* @return A const reference to the RTPSParticipantConstantAttributes of this RTPSParticipantImpl.
225+
*/
226+
const RTPSParticipantConstantAttributes& get_const_attributes() const;
227+
228+
/**
229+
* @brief Get a const copy of RTPSParticipantMutableAttributes of this RTPSParticipantImpl.
230+
* This method is thread safe because it returns a const copy of the internal mutable attributes.
231+
* @return A const copy of the RTPSParticipantMutableAttributes of this RTPSParticipantImpl.
232+
*/
233+
const RTPSParticipantMutableAttributes get_mutable_attributes() const;
234+
235+
/**
236+
* Get a copy of the current state of the RTPSParticipantAttributes.
237+
* @return RTPSParticipantAttributes copy.
238+
*/
239+
RTPSParticipantAttributes copy_attributes() const;
240+
219241
/**
220242
* Retrieves the maximum message size.
221243
*/

include/fastdds/rtps/security/accesscontrol/AccessControl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define _FASTDDS_RTPS_SECURITY_ACCESSCONTROL_ACCESSCONTROL_H_
2020

2121
#include <fastdds/rtps/security/common/Handle.h>
22+
#include <fastdds/rtps/attributes/PropertyPolicy.h>
2223
#include <fastdds/rtps/common/Token.h>
2324

2425
namespace eprosima {
@@ -48,7 +49,7 @@ class AccessControl
4849
Authentication& auth_plugin,
4950
const IdentityHandle& identity,
5051
const uint32_t domain_id,
51-
const RTPSParticipantAttributes& participant_attr,
52+
const PropertyPolicy& part_props,
5253
SecurityException& exception) = 0;
5354

5455
virtual bool get_permissions_token(
@@ -88,7 +89,6 @@ class AccessControl
8889
virtual bool check_create_participant(
8990
const PermissionsHandle& local_handle,
9091
const uint32_t domain_id,
91-
const RTPSParticipantAttributes& qos,
9292
SecurityException& exception) = 0;
9393

9494
virtual bool check_remote_participant(

include/fastdds/rtps/security/authentication/Authentication.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Authentication
6969
* @param adjusted_participant_key (out) The GUID_t that the implementation shall use to uniquely identify the
7070
* RTPSParticipant on the network.
7171
* @param domain_id The Domain Id of the RTPSParticipant.
72-
* @param participant_attr The RTPSParticipantAttributes of the RTPSParticipant.
72+
* @param part_props The PropertyPolicy of the RTPSParticipant.
7373
* @param candidate_participant_key The GUID_t that the DDS implementation would have used to uniquely identify
7474
* the RTPSParticipant if the Security plugins were not enabled.
7575
* @param exception (out) A SecurityException object.
@@ -79,7 +79,7 @@ class Authentication
7979
IdentityHandle** local_identity_handle,
8080
GUID_t& adjusted_participant_key,
8181
const uint32_t domain_id,
82-
const RTPSParticipantAttributes& participant_attr,
82+
const PropertyPolicy& part_props,
8383
const GUID_t& candidate_participant_key,
8484
SecurityException& exception) = 0;
8585

0 commit comments

Comments
 (0)