From fa23ed4553480dc0cb89a080b78a61cd7e8ef683 Mon Sep 17 00:00:00 2001 From: Mario Dominguez Date: Wed, 6 Nov 2024 10:34:37 +0100 Subject: [PATCH] Refs #22033: Modify secure builtins initial payload size Signed-off-by: Mario Dominguez --- src/cpp/rtps/security/SecurityManager.cpp | 10 +++++----- src/cpp/rtps/security/SecurityManager.h | 10 +++++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/cpp/rtps/security/SecurityManager.cpp b/src/cpp/rtps/security/SecurityManager.cpp index 746e485ccab..fb796cb04ed 100644 --- a/src/cpp/rtps/security/SecurityManager.cpp +++ b/src/cpp/rtps/security/SecurityManager.cpp @@ -1081,11 +1081,11 @@ void SecurityManager::delete_participant_stateless_message_entities() void SecurityManager::create_participant_stateless_message_pool() { participant_stateless_message_writer_hattr_ = - { PREALLOCATED_WITH_REALLOC_MEMORY_MODE, participant_->getMaxMessageSize(), 19, 19 }; + { PREALLOCATED_WITH_REALLOC_MEMORY_MODE, PARTICIPANT_STATELESS_MESSAGE_PAYLOAD_DEFAULT_SIZE, 20, 100}; participant_stateless_message_reader_hattr_ = - { PREALLOCATED_WITH_REALLOC_MEMORY_MODE, participant_->getMaxMessageSize(), 10, 5000 }; + { PREALLOCATED_WITH_REALLOC_MEMORY_MODE, PARTICIPANT_STATELESS_MESSAGE_PAYLOAD_DEFAULT_SIZE, 10, 5000}; - BasicPoolConfig cfg{ PREALLOCATED_WITH_REALLOC_MEMORY_MODE, participant_->getMaxMessageSize() }; + BasicPoolConfig cfg{ PREALLOCATED_WITH_REALLOC_MEMORY_MODE, PARTICIPANT_STATELESS_MESSAGE_PAYLOAD_DEFAULT_SIZE}; participant_stateless_message_pool_ = TopicPayloadPoolRegistry::get("DCPSParticipantStatelessMessage", cfg); PoolConfig writer_cfg = PoolConfig::from_history_attributes(participant_stateless_message_writer_hattr_); @@ -1239,7 +1239,7 @@ void SecurityManager::delete_participant_volatile_message_secure_entities() void SecurityManager::create_participant_volatile_message_secure_pool() { participant_volatile_message_secure_hattr_ = - { PREALLOCATED_WITH_REALLOC_MEMORY_MODE, participant_->getMaxMessageSize(), 10, 0 }; + { PREALLOCATED_WITH_REALLOC_MEMORY_MODE, PARTICIPANT_VOLATILE_MESSAGE_PAYLOAD_DEFAULT_SIZE, 10, 0 }; PoolConfig pool_cfg = PoolConfig::from_history_attributes(participant_volatile_message_secure_hattr_); participant_volatile_message_secure_pool_ = @@ -1935,7 +1935,7 @@ void SecurityManager::process_participant_volatile_message_secure( } else { - EPROSIMA_LOG_INFO(SECURITY, "Discarted ParticipantGenericMessage with class id " << message.message_class_id()); + EPROSIMA_LOG_INFO(SECURITY, "Discarded ParticipantGenericMessage with class id " << message.message_class_id()); } } diff --git a/src/cpp/rtps/security/SecurityManager.h b/src/cpp/rtps/security/SecurityManager.h index 27845b747d1..7c62690fadc 100644 --- a/src/cpp/rtps/security/SecurityManager.h +++ b/src/cpp/rtps/security/SecurityManager.h @@ -70,6 +70,9 @@ struct EndpointSecurityAttributes; */ class SecurityManager : private WriterListener { + static constexpr std::size_t PARTICIPANT_STATELESS_MESSAGE_PAYLOAD_DEFAULT_SIZE = 8192; + static constexpr std::size_t PARTICIPANT_VOLATILE_MESSAGE_PAYLOAD_DEFAULT_SIZE = 1024; + public: /** @@ -403,7 +406,7 @@ class SecurityManager : private WriterListener } AuthenticationInfo( - AuthenticationInfo&& auth) + AuthenticationInfo&& auth) noexcept : identity_handle_(std::move(auth.identity_handle_)) , handshake_handle_(std::move(auth.handshake_handle_)) , auth_status_(auth.auth_status_) @@ -411,6 +414,11 @@ class SecurityManager : private WriterListener , change_sequence_number_(std::move(auth.change_sequence_number_)) , event_(std::move(auth.event_)) { + auth.identity_handle_ = nullptr; + auth.handshake_handle_ = nullptr; + auth.auth_status_ = AUTHENTICATION_NOT_AVAILABLE; + auth.expected_sequence_number_ = 0; + auth.change_sequence_number_ = SequenceNumber_t::unknown(); } int32_t handshake_requests_sent_;