Skip to content

Commit

Permalink
Refs #21841: Update MonitorService class
Browse files Browse the repository at this point in the history
Signed-off-by: Mario Dominguez <mariodominguez@eprosima.com>
  • Loading branch information
Mario-DL committed Oct 21, 2024
1 parent 966edf5 commit 4516d38
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/cpp/statistics/rtps/monitor-service/MonitorService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,26 @@ bool MonitorService::disable_monitor_service()
bool MonitorService::remove_local_entity(
const fastdds::rtps::EntityId_t& entity_id)
{
// Remove the entity from the extended incompatible QoS collection
{
std::lock_guard<std::mutex> lock(extended_incompatible_qos_mtx_);
GUID_t entity_guid = {local_participant_guid_.guidPrefix, entity_id};
extended_incompatible_qos_collection_.erase(entity_guid);
}

// Remove the entity from the local entities
{
std::lock_guard<std::mutex> lock (mtx_);

//! Add the entity to the changed entities if was not already present
if (!local_entities_[entity_id].second)
{
changed_entities_.push_back(entity_id);
if (!timer_active_.load())
{
event_->restart_timer();
timer_active_.store(true);
}
}

//! But remove it from the collection of entities
Expand Down Expand Up @@ -326,6 +339,12 @@ bool MonitorService::write_status(
status_retrieved = status_queryable_.get_monitoring_status(local_entity_guid, data);
break;
}
case StatusKind::EXTENDED_INCOMPATIBLE_QOS:
{
std::lock_guard<std::mutex> lock(extended_incompatible_qos_mtx_);
data.extended_incompatible_qos_status(extended_incompatible_qos_collection_[local_entity_guid]);
break;
}
default:
{
EPROSIMA_LOG_ERROR(MONITOR_SERVICE, "Referring to an unknown status");
Expand Down
9 changes: 9 additions & 0 deletions src/cpp/statistics/rtps/monitor-service/MonitorService.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class MonitorService
{
static constexpr int MIN_TIME_BETWEEN_PUBS_MS = 500;

friend class MonitorServiceListener;

public:

using endpoint_creator_t = std::function<bool (fastdds::rtps::RTPSWriter**,
Expand Down Expand Up @@ -257,6 +259,13 @@ class MonitorService
endpoint_registrator_t endpoint_registrator_;

MonitorServiceStatusDataPubSubType type_;

// Stores the current extended incompatible qos status
// of local entities with remote entities and their policies.
std::map<fastdds::rtps::GUID_t, ExtendedIncompatibleQoSStatusSeq_s>
extended_incompatible_qos_collection_;

std::mutex extended_incompatible_qos_mtx_;
};

#endif // FASTDDS_STATISTICS
Expand Down

0 comments on commit 4516d38

Please sign in to comment.