diff --git a/include/fastdds/dds/core/policy/QosPolicies.hpp b/include/fastdds/dds/core/policy/QosPolicies.hpp index 5ac318e57db..26b5c0b6ac9 100644 --- a/include/fastdds/dds/core/policy/QosPolicies.hpp +++ b/include/fastdds/dds/core/policy/QosPolicies.hpp @@ -1728,21 +1728,21 @@ class ResourceLimitsQosPolicy : public Parameter_t, public QosPolicy * @brief Specifies the maximum number of data-samples the DataWriter (or DataReader) can manage across all the * instances associated with it. Represents the maximum samples the middleware can store for any one DataWriter * (or DataReader).
- * Value 0 means infinite resources. By default, 5000. + * Value less or equal to 0 means infinite resources. By default, 5000. * * @warning It is inconsistent if `max_samples < (max_instances * max_samples_per_instance)`. */ int32_t max_samples; /** * @brief Represents the maximum number of instances DataWriter (or DataReader) can manage.
- * Value 0 means infinite resources. By default, 10. + * Value less or equal to 0 means infinite resources. By default, 10. * * @warning It is inconsistent if `(max_instances * max_samples_per_instance) > max_samples`. */ int32_t max_instances; /** * @brief Represents the maximum number of samples of any one instance a DataWriter(or DataReader) can manage.
- * Value 0 means infinite resources. By default, 400. + * Value less or equal to 0 means infinite resources. By default, 400. * * @warning It is inconsistent if `(max_instances * max_samples_per_instance) > max_samples`. */ diff --git a/src/cpp/fastdds/publisher/DataWriterHistory.cpp b/src/cpp/fastdds/publisher/DataWriterHistory.cpp index d2d4ae800af..19a2ae66483 100644 --- a/src/cpp/fastdds/publisher/DataWriterHistory.cpp +++ b/src/cpp/fastdds/publisher/DataWriterHistory.cpp @@ -67,6 +67,11 @@ DataWriterHistory::DataWriterHistory( , topic_att_(topic_att) , unacknowledged_sample_removed_functor_(unack_sample_remove_functor) { + if (resource_limited_qos_.max_samples <= 0) + { + resource_limited_qos_.max_samples = std::numeric_limits::max(); + } + if (resource_limited_qos_.max_instances <= 0) { resource_limited_qos_.max_instances = std::numeric_limits::max(); diff --git a/src/cpp/fastrtps_deprecated/publisher/PublisherHistory.cpp b/src/cpp/fastrtps_deprecated/publisher/PublisherHistory.cpp index 26703e9c2fb..a29dd48ac9c 100644 --- a/src/cpp/fastrtps_deprecated/publisher/PublisherHistory.cpp +++ b/src/cpp/fastrtps_deprecated/publisher/PublisherHistory.cpp @@ -66,6 +66,11 @@ PublisherHistory::PublisherHistory( , resource_limited_qos_(topic_att.resourceLimitsQos) , topic_att_(topic_att) { + if (resource_limited_qos_.max_samples <= 0) + { + resource_limited_qos_.max_samples = std::numeric_limits::max(); + } + if (resource_limited_qos_.max_instances <= 0) { resource_limited_qos_.max_instances = 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 38232c58087..f8de9591e5b 100644 --- a/test/mock/rtps/PublisherHistory/fastdds/publisher/DataWriterHistory.hpp +++ b/test/mock/rtps/PublisherHistory/fastdds/publisher/DataWriterHistory.hpp @@ -79,6 +79,11 @@ class DataWriterHistory : public WriterHistory , topic_att_(topic_att) , unacknowledged_sample_removed_functor_(unack_sample_remove_functor) { + if (resource_limited_qos_.max_samples <= 0) + { + resource_limited_qos_.max_samples = std::numeric_limits::max(); + } + if (resource_limited_qos_.max_instances <= 0) { resource_limited_qos_.max_instances = 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 9af271736c5..12655721d96 100644 --- a/test/mock/rtps/PublisherHistory/fastrtps/publisher/PublisherHistory.h +++ b/test/mock/rtps/PublisherHistory/fastrtps/publisher/PublisherHistory.h @@ -74,6 +74,11 @@ class PublisherHistory : public WriterHistory , resource_limited_qos_(topic_att.resourceLimitsQos) , topic_att_(topic_att) { + if (resource_limited_qos_.max_samples <= 0) + { + resource_limited_qos_.max_samples = std::numeric_limits::max(); + } + if (resource_limited_qos_.max_instances <= 0) { resource_limited_qos_.max_instances = std::numeric_limits::max();