Skip to content

Commit

Permalink
fix QoS depth settings for clients/service ignored (#564)
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Lihui <[email protected]>

Co-authored-by: Miguel Company <[email protected]>
  • Loading branch information
Chen Lihui and MiguelCompany authored Oct 6, 2021
1 parent daeeb8c commit 32ce21d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "fastdds/dds/subscriber/DataReader.hpp"
#include "fastdds/dds/subscriber/DataReaderListener.hpp"
#include "fastdds/dds/subscriber/SampleInfo.hpp"
#include "fastdds/dds/subscriber/qos/DataReaderQos.hpp"
#include "fastdds/dds/topic/TypeSupport.hpp"

#include "fastdds/rtps/common/Guid.h"
Expand Down Expand Up @@ -104,6 +105,12 @@ class ClientListener : public eprosima::fastdds::dds::DataReaderListener
response.sample_identity_.writer_guid() == info_->writer_guid_)
{
std::lock_guard<std::mutex> lock(internalMutex_);
const eprosima::fastrtps::HistoryQosPolicy & history = reader->get_qos().history();
if (eprosima::fastrtps::KEEP_LAST_HISTORY_QOS == history.kind) {
while (list.size() >= static_cast<size_t>(history.depth)) {
list.pop_front();
}
}

if (conditionMutex_ != nullptr) {
std::unique_lock<std::mutex> clock(*conditionMutex_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "fastdds/dds/subscriber/DataReader.hpp"
#include "fastdds/dds/subscriber/DataReaderListener.hpp"
#include "fastdds/dds/subscriber/SampleInfo.hpp"
#include "fastdds/dds/subscriber/qos/DataReaderQos.hpp"
#include "fastdds/dds/topic/TypeSupport.hpp"

#include "fastdds/rtps/common/Guid.h"
Expand Down Expand Up @@ -225,6 +226,12 @@ class ServiceListener : public eprosima::fastdds::dds::DataReaderListener
info_->pub_listener_->endpoint_add_reader_and_writer(reader_guid, writer_guid);

std::lock_guard<std::mutex> lock(internalMutex_);
const eprosima::fastrtps::HistoryQosPolicy & history = reader->get_qos().history();
if (eprosima::fastrtps::KEEP_LAST_HISTORY_QOS == history.kind) {
while (list.size() >= static_cast<size_t>(history.depth)) {
list.pop_front();
}
}

if (conditionMutex_ != nullptr) {
std::unique_lock<std::mutex> clock(*conditionMutex_);
Expand Down

0 comments on commit 32ce21d

Please sign in to comment.