Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/fastdds/rtps/participant/RTPSParticipant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class FASTDDS_EXPORTED_API RTPSParticipant
* Get a reference of the current state of the RTPSParticipantParameters.
* @return RTPSParticipantAttributes reference.
*/
const RTPSParticipantAttributes& get_attributes() const;
RTPSParticipantAttributes get_attributes() const;

/**
* Retrieves the maximum message size.
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/BuiltinProtocols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ bool BuiltinProtocols::initBuiltinProtocols(

filter_server_remote_locators(p_part->network_factory());

const RTPSParticipantAllocationAttributes& allocation = p_part->get_attributes().allocation;
RTPSParticipantAllocationAttributes allocation = p_part->get_attributes().allocation;

// PDP
switch (m_att.discovery_config.discoveryProtocol)
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/endpoint/EDPStatic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ bool EDPStatic::initEDP(
}

// Check there is a Participant's property changing the exchange format.
auto& properties = mp_RTPSParticipant->get_attributes().properties.properties();
auto properties = mp_RTPSParticipant->get_attributes().properties.properties();
for (auto& property : properties)
{
if (0 == property.name().compare(exchange_format_property_name))
Expand Down
6 changes: 3 additions & 3 deletions src/cpp/rtps/builtin/discovery/participant/PDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,7 @@ static void set_builtin_endpoint_locators(
const PDP* pdp,
const BuiltinProtocols* builtin)
{
const RTPSParticipantAttributes& pattr = pdp->getRTPSParticipant()->get_attributes();
RTPSParticipantAttributes pattr = pdp->getRTPSParticipant()->get_attributes();

auto part_data = pdp->getLocalParticipantProxyData();
if (nullptr == part_data)
Expand Down Expand Up @@ -1669,7 +1669,7 @@ ReaderAttributes PDP::create_builtin_reader_attributes()
{
ReaderAttributes attributes;

const RTPSParticipantAttributes& pattr = getRTPSParticipant()->get_attributes();
RTPSParticipantAttributes pattr = getRTPSParticipant()->get_attributes();
set_builtin_matched_allocation(attributes.matched_writers_allocation, pattr);

// Builtin endpoints are always reliable, transient local, keyed topics
Expand All @@ -1693,7 +1693,7 @@ WriterAttributes PDP::create_builtin_writer_attributes()
{
WriterAttributes attributes;

const RTPSParticipantAttributes& pattr = getRTPSParticipant()->get_attributes();
RTPSParticipantAttributes pattr = getRTPSParticipant()->get_attributes();
set_builtin_matched_allocation(attributes.matched_readers_allocation, pattr);

// Builtin endpoints are always reliable, transient local, keyed topics
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/participant/PDPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ bool PDPClient::create_secure_ds_pdp_endpoints()
bool PDPClient::create_ds_pdp_best_effort_reader(
DiscoveryServerPDPEndpointsSecure& endpoints)
{
const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes();
RTPSParticipantAttributes pattr = mp_RTPSParticipant->get_attributes();

HistoryAttributes hatt;
hatt.payloadMaxSize = mp_builtin->m_att.readerPayloadSize;
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/builtin/discovery/participant/PDPListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void PDPListener::on_new_cache_change_added(
}

// Filter locators
const auto& pattr = parent_pdp_->getRTPSParticipant()->get_attributes();
auto pattr = parent_pdp_->getRTPSParticipant()->get_attributes();
fastdds::rtps::network::external_locators::filter_remote_locators(temp_participant_data_,
pattr.builtin.metatraffic_external_unicast_locators, pattr.default_external_unicast_locators,
pattr.ignore_non_matching_locators);
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ bool PDPServer::init(
getRTPSParticipant()->enableReader(edp->publications_reader_.first);

// Initialize server dedicated thread.
const RTPSParticipantAttributes& part_attr = getRTPSParticipant()->get_attributes();
RTPSParticipantAttributes part_attr = getRTPSParticipant()->get_attributes();
uint32_t id_for_thread = static_cast<uint32_t>(part_attr.participantID);
const fastdds::rtps::ThreadSettings& thr_config = part_attr.discovery_server_thread;
resource_event_thread_.init_thread(thr_config, "dds.ds_ev.%u", id_for_thread);
Expand Down Expand Up @@ -252,7 +252,7 @@ bool PDPServer::create_secure_ds_pdp_endpoints()
bool PDPServer::create_ds_pdp_best_effort_reader(
DiscoveryServerPDPEndpointsSecure& endpoints)
{
const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes();
RTPSParticipantAttributes pattr = mp_RTPSParticipant->get_attributes();

HistoryAttributes hatt;
hatt.payloadMaxSize = mp_builtin->m_att.readerPayloadSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void PDPServerListener::on_new_cache_change_added(
EPROSIMA_LOG_INFO(RTPS_PDP_LISTENER, "Participant type " << participant_type_str);
bool is_client = ret.second;

const auto& pattr = pdp_server()->getRTPSParticipant()->get_attributes();
auto pattr = pdp_server()->getRTPSParticipant()->get_attributes();
fastdds::rtps::network::external_locators::filter_remote_locators(participant_data,
pattr.builtin.metatraffic_external_unicast_locators, pattr.default_external_unicast_locators,
pattr.ignore_non_matching_locators);
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/builtin/discovery/participant/PDPSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ bool PDPSimple::createPDPEndpoints()

bool PDPSimple::create_dcps_participant_endpoints()
{
const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes();
RTPSParticipantAttributes pattr = mp_RTPSParticipant->get_attributes();
const RTPSParticipantAllocationAttributes& allocation = pattr.allocation;
const BuiltinAttributes& builtin_att = mp_builtin->m_att;
auto endpoints = dynamic_cast<fastdds::rtps::SimplePDPEndpoints*>(builtin_endpoints_.get());
Expand Down Expand Up @@ -466,7 +466,7 @@ bool PDPSimple::create_dcps_participant_endpoints()
#if HAVE_SECURITY
bool PDPSimple::create_dcps_participant_secure_endpoints()
{
const RTPSParticipantAttributes& pattr = mp_RTPSParticipant->get_attributes();
RTPSParticipantAttributes pattr = mp_RTPSParticipant->get_attributes();
const RTPSParticipantAllocationAttributes& allocation = pattr.allocation;
const BuiltinAttributes& builtin_att = mp_builtin->m_att;
auto endpoints = dynamic_cast<fastdds::rtps::SimplePDPEndpointsSecure*>(builtin_endpoints_.get());
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/builtin/liveliness/WLP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ bool WLP::initWL(

bool WLP::createEndpoints()
{
const RTPSParticipantAttributes& pattr = mp_participant->get_attributes();
RTPSParticipantAttributes pattr = mp_participant->get_attributes();
const ResourceLimitedContainerConfig& participants_allocation = pattr.allocation.participants;

// Built-in writer history
Expand Down Expand Up @@ -320,7 +320,7 @@ bool WLP::createEndpoints()

bool WLP::createSecureEndpoints()
{
const RTPSParticipantAttributes& pattr = mp_participant->get_attributes();
RTPSParticipantAttributes pattr = mp_participant->get_attributes();
const ResourceLimitedContainerConfig& participants_allocation = pattr.allocation.participants;

//CREATE WRITER
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/participant/RTPSParticipant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ std::vector<std::string> RTPSParticipant::getParticipantNames() const
return mp_impl->getParticipantNames();
}

const RTPSParticipantAttributes& RTPSParticipant::get_attributes() const
RTPSParticipantAttributes RTPSParticipant::get_attributes() const
{
return mp_impl->get_attributes();
}
Expand Down
24 changes: 20 additions & 4 deletions src/cpp/rtps/participant/RTPSParticipantImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ RTPSParticipantImpl::RTPSParticipantImpl(
, internal_metatraffic_locators_(false)
, internal_default_locators_(false)
#if HAVE_SECURITY
, m_security_manager(this, *this)
, m_security_manager(this, PParam, *this)
#endif // if HAVE_SECURITY
, mp_participantListener(plisten)
, mp_userParticipant(par)
Expand Down Expand Up @@ -1659,7 +1659,7 @@ void RTPSParticipantImpl::update_attributes(
// Update the attributes data member
{
std::lock_guard<std::mutex> _(mutex_);
m_att = temp_atts;
update_mutable_attributes(temp_atts);
}

if (update_pdp)
Expand All @@ -1669,6 +1669,17 @@ void RTPSParticipantImpl::update_attributes(
}
}

void RTPSParticipantImpl::update_mutable_attributes(
const RTPSParticipantAttributes& patt)
{
// NTS
m_att.userData = patt.userData;
m_att.builtin.metatrafficUnicastLocatorList = patt.builtin.metatrafficUnicastLocatorList;
m_att.defaultUnicastLocatorList = patt.defaultUnicastLocatorList;
m_att.default_external_unicast_locators = patt.default_external_unicast_locators;
m_att.builtin.discovery_config.m_DiscoveryServers = patt.builtin.discovery_config.m_DiscoveryServers;
}

bool RTPSParticipantImpl::update_writer(
RTPSWriter* rtps_writer,
const fastdds::dds::WriterQos& wqos)
Expand Down Expand Up @@ -2860,7 +2871,11 @@ DurabilityKind_t RTPSParticipantImpl::get_persistence_durability_red_line(

void RTPSParticipantImpl::environment_file_has_changed()
{
RTPSParticipantAttributes patt = m_att;
RTPSParticipantAttributes patt;
{
std::lock_guard<std::mutex> _(mutex_);
patt = m_att;
}
// Only if it is a server/backup or a client override
if (DiscoveryProtocol::SERVER == m_att.builtin.discovery_config.discoveryProtocol ||
DiscoveryProtocol::BACKUP == m_att.builtin.discovery_config.discoveryProtocol ||
Expand Down Expand Up @@ -3413,8 +3428,9 @@ dds::utils::TypePropagation RTPSParticipantImpl::type_propagation() const
return dds::utils::to_type_propagation(m_att.properties);
}

const RTPSParticipantAttributes& RTPSParticipantImpl::get_attributes() const
RTPSParticipantAttributes RTPSParticipantImpl::get_attributes() const
{
std::lock_guard<std::mutex> _(mutex_);
return m_att;
}

Expand Down
5 changes: 4 additions & 1 deletion src/cpp/rtps/participant/RTPSParticipantImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ class RTPSParticipantImpl

public:

const RTPSParticipantAttributes& get_attributes() const;
RTPSParticipantAttributes get_attributes() const;

/**
* Create a Writer in this RTPSParticipant.
Expand Down Expand Up @@ -990,6 +990,9 @@ class RTPSParticipantImpl
void update_attributes(
const RTPSParticipantAttributes& patt);

void update_mutable_attributes(
const RTPSParticipantAttributes& patt);

/**
* Update local writer QoS
* @param rtps_writer Writer to update.
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/reader/BaseReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ BaseReader::~BaseReader()
bool BaseReader::matched_writer_add(
const PublicationBuiltinTopicData& info)
{
const auto& alloc = mp_RTPSParticipant->get_attributes().allocation;
auto alloc = mp_RTPSParticipant->get_attributes().allocation;
WriterProxyData wdata(alloc.data_limits, info);

return matched_writer_add_edp(wdata);
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/reader/StatefulReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void StatefulReader::init(
RTPSParticipantImpl* pimpl,
const ReaderAttributes& att)
{
const RTPSParticipantAttributes& part_att = pimpl->get_attributes();
RTPSParticipantAttributes part_att = pimpl->get_attributes();
for (size_t n = 0; n < att.matched_writers_allocation.initial; ++n)
{
matched_writers_pool_.push_back(new WriterProxy(this, part_att.allocation.locators, proxy_changes_config_));
Expand Down Expand Up @@ -264,7 +264,7 @@ bool StatefulReader::matched_writer_add_edp(
size_t max_readers = matched_writers_pool_.max_size();
if (getMatchedWritersSize() + matched_writers_pool_.size() < max_readers)
{
const RTPSParticipantAttributes& part_att = mp_RTPSParticipant->get_attributes();
RTPSParticipantAttributes part_att = mp_RTPSParticipant->get_attributes();
wp = new WriterProxy(this, part_att.allocation.locators, proxy_changes_config_);
}
else
Expand Down
23 changes: 12 additions & 11 deletions src/cpp/rtps/security/SecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ static CacheChange_t* create_change_for_message(

SecurityManager::SecurityManager(
RTPSParticipantImpl* participant,
const RTPSParticipantAttributes& pattr,
ISecurityPluginFactory& plugin_factory)
: participant_stateless_message_listener_(*this)
, participant_volatile_message_secure_listener_(*this)
Expand All @@ -97,14 +98,14 @@ SecurityManager::SecurityManager(
, auth_last_sequence_number_(1)
, crypto_last_sequence_number_(1)
, temp_reader_proxies_({
participant->get_attributes().allocation.locators.max_unicast_locators,
participant->get_attributes().allocation.locators.max_multicast_locators,
participant->get_attributes().allocation.data_limits,
participant->get_attributes().allocation.content_filter})
pattr.allocation.locators.max_unicast_locators,
pattr.allocation.locators.max_multicast_locators,
pattr.allocation.data_limits,
pattr.allocation.content_filter})
, temp_writer_proxies_({
participant->get_attributes().allocation.locators.max_unicast_locators,
participant->get_attributes().allocation.locators.max_multicast_locators,
participant->get_attributes().allocation.data_limits})
pattr.allocation.locators.max_unicast_locators,
pattr.allocation.locators.max_multicast_locators,
pattr.allocation.data_limits})
{
assert(participant != nullptr);
}
Expand Down Expand Up @@ -1123,7 +1124,7 @@ bool SecurityManager::create_participant_stateless_message_writer()
participant_stateless_message_writer_hattr_,
participant_stateless_message_pool_);

const RTPSParticipantAttributes& pattr = participant_->get_attributes();
RTPSParticipantAttributes pattr = participant_->get_attributes();

WriterAttributes watt;
watt.endpoint.external_unicast_locators = pattr.builtin.metatraffic_external_unicast_locators;
Expand Down Expand Up @@ -1172,7 +1173,7 @@ bool SecurityManager::create_participant_stateless_message_reader()
{
participant_stateless_message_reader_history_ = new ReaderHistory(participant_stateless_message_reader_hattr_);

const RTPSParticipantAttributes& pattr = participant_->get_attributes();
RTPSParticipantAttributes pattr = participant_->get_attributes();

ReaderAttributes ratt;
ratt.endpoint.topicKind = NO_KEY;
Expand Down Expand Up @@ -1271,7 +1272,7 @@ bool SecurityManager::create_participant_volatile_message_secure_writer()
participant_volatile_message_secure_writer_history_ =
new WriterHistory(participant_volatile_message_secure_hattr_, participant_volatile_message_secure_pool_);

const RTPSParticipantAttributes& pattr = participant_->get_attributes();
RTPSParticipantAttributes pattr = participant_->get_attributes();

WriterAttributes watt;
watt.endpoint.endpointKind = WRITER;
Expand Down Expand Up @@ -1324,7 +1325,7 @@ bool SecurityManager::create_participant_volatile_message_secure_reader()
participant_volatile_message_secure_reader_history_ =
new ReaderHistory(participant_volatile_message_secure_hattr_);

const RTPSParticipantAttributes& pattr = participant_->get_attributes();
RTPSParticipantAttributes pattr = participant_->get_attributes();

ReaderAttributes ratt;
ratt.endpoint.topicKind = NO_KEY;
Expand Down
1 change: 1 addition & 0 deletions src/cpp/rtps/security/SecurityManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class SecurityManager : private WriterListener
*/
SecurityManager(
RTPSParticipantImpl* participant,
const RTPSParticipantAttributes& pattr,
ISecurityPluginFactory& plugin_factory);

// @brief Destructor
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/writer/BaseWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ BaseWriter::~BaseWriter()
bool BaseWriter::matched_reader_add(
const SubscriptionBuiltinTopicData& rqos)
{
const auto& alloc = mp_RTPSParticipant->get_attributes().allocation;
auto alloc = mp_RTPSParticipant->get_attributes().allocation;
ReaderProxyData rdata(alloc.data_limits, rqos);

return matched_reader_add_edp(rdata);
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/writer/StatefulWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void StatefulWriter::init(
RTPSParticipantImpl* pimpl,
const WriterAttributes& att)
{
const RTPSParticipantAttributes& part_att = pimpl->get_attributes();
RTPSParticipantAttributes part_att = pimpl->get_attributes();

auto push_mode = PropertyPolicyHelper::find_property(att.endpoint.properties, "fastdds.push_mode");
push_mode_ = !((nullptr != push_mode) && ("false" == *push_mode));
Expand Down Expand Up @@ -1025,7 +1025,7 @@ bool StatefulWriter::matched_reader_add_edp(
size_t max_readers = matched_readers_pool_.max_size();
if (get_matched_readers_size() + matched_readers_pool_.size() < max_readers)
{
const RTPSParticipantAttributes& part_att = mp_RTPSParticipant->get_attributes();
RTPSParticipantAttributes part_att = mp_RTPSParticipant->get_attributes();
rp = new ReaderProxy(times_, part_att.allocation.locators, this);
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/rtps/writer/StatelessWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void StatelessWriter::init(
{
get_builtin_guid();

const RemoteLocatorsAllocationAttributes& loc_alloc =
RemoteLocatorsAllocationAttributes loc_alloc =
participant->get_attributes().allocation.locators;

for (size_t i = 0; i < attributes.matched_readers_allocation.initial; ++i)
Expand Down Expand Up @@ -511,7 +511,7 @@ bool StatelessWriter::matched_reader_add_edp(
size_t max_readers = matched_readers_pool_.max_size();
if (get_matched_readers_size() + matched_readers_pool_.size() < max_readers)
{
const RemoteLocatorsAllocationAttributes& loc_alloc =
RemoteLocatorsAllocationAttributes loc_alloc =
mp_RTPSParticipant->get_attributes().allocation.locators;

new_reader.reset(new ReaderLocator(
Expand Down
2 changes: 1 addition & 1 deletion test/unittest/rtps/security/SecurityTests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class SecurityTest : public ::testing::Test
, stateless_reader_(nullptr)
, volatile_writer_(nullptr)
, volatile_reader_(nullptr)
, manager_(&participant_, plugin_factory_)
, manager_(&participant_, g_security_default_values_.pattr, plugin_factory_)
, participant_data_(c_default_RTPSParticipantAllocationAttributes)
, default_cdr_message(RTPSMESSAGE_DEFAULT_SIZE)
{
Expand Down
Loading