From 8d7fb2ac698fff7c13989f450a62d8e030bca0d6 Mon Sep 17 00:00:00 2001 From: JesusPoderoso Date: Mon, 25 Mar 2024 16:22:03 +0100 Subject: [PATCH] Refs #20638: Force unlimited ResourceLimits if lower or equal to zero Signed-off-by: JesusPoderoso --- src/cpp/fastdds/publisher/DataWriterHistory.cpp | 4 ++-- src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp | 6 +++--- src/cpp/fastrtps_deprecated/publisher/PublisherHistory.cpp | 4 ++-- .../fastrtps_deprecated/subscriber/SubscriberHistory.cpp | 6 +++--- .../fastdds/publisher/DataWriterHistory.hpp | 4 ++-- .../PublisherHistory/fastrtps/publisher/PublisherHistory.h | 4 ++-- test/performance/throughput/ThroughputPublisher.cpp | 2 +- test/performance/throughput/ThroughputSubscriber.cpp | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/cpp/fastdds/publisher/DataWriterHistory.cpp b/src/cpp/fastdds/publisher/DataWriterHistory.cpp index c8d025a4257..d2d4ae800af 100644 --- a/src/cpp/fastdds/publisher/DataWriterHistory.cpp +++ b/src/cpp/fastdds/publisher/DataWriterHistory.cpp @@ -67,12 +67,12 @@ DataWriterHistory::DataWriterHistory( , topic_att_(topic_att) , unacknowledged_sample_removed_functor_(unack_sample_remove_functor) { - if (resource_limited_qos_.max_instances == 0) + if (resource_limited_qos_.max_instances <= 0) { resource_limited_qos_.max_instances = std::numeric_limits::max(); } - if (resource_limited_qos_.max_samples_per_instance == 0) + if (resource_limited_qos_.max_samples_per_instance <= 0) { resource_limited_qos_.max_samples_per_instance = std::numeric_limits::max(); } diff --git a/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp b/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp index 4796684b483..392c86f4864 100644 --- a/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp +++ b/src/cpp/fastdds/subscriber/history/DataReaderHistory.cpp @@ -70,17 +70,17 @@ DataReaderHistory::DataReaderHistory( , type_(type.get()) , get_key_object_(nullptr) { - if (resource_limited_qos_.max_samples == 0) + if (resource_limited_qos_.max_samples <= 0) { resource_limited_qos_.max_samples = std::numeric_limits::max(); } - if (resource_limited_qos_.max_instances == 0) + if (resource_limited_qos_.max_instances <= 0) { resource_limited_qos_.max_instances = std::numeric_limits::max(); } - if (resource_limited_qos_.max_samples_per_instance == 0) + if (resource_limited_qos_.max_samples_per_instance <= 0) { resource_limited_qos_.max_samples_per_instance = std::numeric_limits::max(); } diff --git a/src/cpp/fastrtps_deprecated/publisher/PublisherHistory.cpp b/src/cpp/fastrtps_deprecated/publisher/PublisherHistory.cpp index a327450b34d..26703e9c2fb 100644 --- a/src/cpp/fastrtps_deprecated/publisher/PublisherHistory.cpp +++ b/src/cpp/fastrtps_deprecated/publisher/PublisherHistory.cpp @@ -66,12 +66,12 @@ PublisherHistory::PublisherHistory( , resource_limited_qos_(topic_att.resourceLimitsQos) , topic_att_(topic_att) { - if (resource_limited_qos_.max_instances == 0) + if (resource_limited_qos_.max_instances <= 0) { resource_limited_qos_.max_instances = std::numeric_limits::max(); } - if (resource_limited_qos_.max_samples_per_instance == 0) + if (resource_limited_qos_.max_samples_per_instance <= 0) { resource_limited_qos_.max_samples_per_instance = std::numeric_limits::max(); } diff --git a/src/cpp/fastrtps_deprecated/subscriber/SubscriberHistory.cpp b/src/cpp/fastrtps_deprecated/subscriber/SubscriberHistory.cpp index 573931a0e6e..6cc37ed0269 100644 --- a/src/cpp/fastrtps_deprecated/subscriber/SubscriberHistory.cpp +++ b/src/cpp/fastrtps_deprecated/subscriber/SubscriberHistory.cpp @@ -96,17 +96,17 @@ SubscriberHistory::SubscriberHistory( get_key_object_ = type_->createData(); } - if (resource_limited_qos_.max_samples == 0) + if (resource_limited_qos_.max_samples <= 0) { resource_limited_qos_.max_samples = std::numeric_limits::max(); } - if (resource_limited_qos_.max_instances == 0) + if (resource_limited_qos_.max_instances <= 0) { resource_limited_qos_.max_instances = std::numeric_limits::max(); } - if (resource_limited_qos_.max_samples_per_instance == 0) + if (resource_limited_qos_.max_samples_per_instance <= 0) { resource_limited_qos_.max_samples_per_instance = std::numeric_limits::max(); } diff --git a/test/mock/rtps/PublisherHistory/fastdds/publisher/DataWriterHistory.hpp b/test/mock/rtps/PublisherHistory/fastdds/publisher/DataWriterHistory.hpp index 1a0613dbfb3..38232c58087 100644 --- a/test/mock/rtps/PublisherHistory/fastdds/publisher/DataWriterHistory.hpp +++ b/test/mock/rtps/PublisherHistory/fastdds/publisher/DataWriterHistory.hpp @@ -79,12 +79,12 @@ class DataWriterHistory : public WriterHistory , topic_att_(topic_att) , unacknowledged_sample_removed_functor_(unack_sample_remove_functor) { - if (resource_limited_qos_.max_instances == 0) + if (resource_limited_qos_.max_instances <= 0) { resource_limited_qos_.max_instances = std::numeric_limits::max(); } - if (resource_limited_qos_.max_samples_per_instance == 0) + if (resource_limited_qos_.max_samples_per_instance <= 0) { resource_limited_qos_.max_samples_per_instance = std::numeric_limits::max(); } diff --git a/test/mock/rtps/PublisherHistory/fastrtps/publisher/PublisherHistory.h b/test/mock/rtps/PublisherHistory/fastrtps/publisher/PublisherHistory.h index dec5df5ed8d..9af271736c5 100644 --- a/test/mock/rtps/PublisherHistory/fastrtps/publisher/PublisherHistory.h +++ b/test/mock/rtps/PublisherHistory/fastrtps/publisher/PublisherHistory.h @@ -74,12 +74,12 @@ class PublisherHistory : public WriterHistory , resource_limited_qos_(topic_att.resourceLimitsQos) , topic_att_(topic_att) { - if (resource_limited_qos_.max_instances == 0) + if (resource_limited_qos_.max_instances <= 0) { resource_limited_qos_.max_instances = std::numeric_limits::max(); } - if (resource_limited_qos_.max_samples_per_instance == 0) + if (resource_limited_qos_.max_samples_per_instance <= 0) { resource_limited_qos_.max_samples_per_instance = std::numeric_limits::max(); } diff --git a/test/performance/throughput/ThroughputPublisher.cpp b/test/performance/throughput/ThroughputPublisher.cpp index ba56678fde8..3e5a668d6cf 100644 --- a/test/performance/throughput/ThroughputPublisher.cpp +++ b/test/performance/throughput/ThroughputPublisher.cpp @@ -527,7 +527,7 @@ void ThroughputPublisher::run( else { // Ensure that the max samples is at least the demand - if (dw_qos.resource_limits().max_samples < 0 || + if (dw_qos.resource_limits().max_samples <= 0 || static_cast(dw_qos.resource_limits().max_samples) < max_demand) { EPROSIMA_LOG_WARNING(THROUGHPUTPUBLISHER, "Setting resource limit max samples to " << max_demand); diff --git a/test/performance/throughput/ThroughputSubscriber.cpp b/test/performance/throughput/ThroughputSubscriber.cpp index 70f326bc5c5..b0532bee28c 100644 --- a/test/performance/throughput/ThroughputSubscriber.cpp +++ b/test/performance/throughput/ThroughputSubscriber.cpp @@ -585,7 +585,7 @@ int ThroughputSubscriber::process_message() else { // Ensure that the max samples is at least the demand - if (dr_qos.resource_limits().max_samples < 0 || + if (dr_qos.resource_limits().max_samples <= 0 || static_cast(dr_qos.resource_limits().max_samples) < max_demand) { EPROSIMA_LOG_WARNING(THROUGHPUTSUBSCRIBER,