@@ -131,6 +131,30 @@ utils::ReturnCode DdsPipe::reload_configuration(
131131 return reload_allowed_topics_ (allowed_topics);
132132}
133133
134+ // void DdsPipe::reload_filter_partition(
135+ // const std::set<std::string> filter_partition_set)
136+ // {
137+ // update_filter(filter_partition_set);
138+
139+ // std::vector<DdsBridge*> targets;
140+ // {
141+ // std::lock_guard<std::mutex> lock(bridges_mutex_);
142+
143+ // for (const auto& bridge : bridges_)
144+ // {
145+ // if (bridge.second)
146+ // {
147+ // targets.push_back(bridge.second.get());
148+ // }
149+ // }
150+ // }
151+
152+ // for (auto* target : targets)
153+ // {
154+ // target->update_readers_track(filter_partition_set);
155+ // }
156+ // }
157+
134158utils::ReturnCode DdsPipe::enable () noexcept
135159{
136160 std::lock_guard<std::mutex> lock (mutex_);
@@ -292,7 +316,40 @@ void DdsPipe::discovered_endpoint_nts_(
292316 }
293317 else if (is_endpoint_relevant_ (endpoint))
294318 {
295- discovered_topic_nts_ (utils::Heritable<DdsTopic>::make_heritable (endpoint.topic ));
319+ DdsTopic topic_with_partitions = endpoint.topic ;
320+ topic_with_partitions.partition_name = endpoint.specific_partitions ;
321+
322+ discovered_topic_nts_ (utils::Heritable<DdsTopic>::make_heritable (topic_with_partitions));
323+ }
324+ else
325+ {
326+ // there is a filter.
327+ // update the track of the topic to
328+ // add the partition in the reader if it is in the filter
329+
330+ // update partitions under bridges_mutex_
331+ {
332+ std::lock_guard<std::mutex> lock (bridges_mutex_);
333+
334+ const auto bridge_it = bridges_.find (utils::Heritable<DdsTopic>::make_heritable (endpoint.topic ));
335+ // add the specific partition of the endpoint in the bridges topic.
336+ if (bridge_it != bridges_.end ())
337+ {
338+ std::ostringstream guid_ss;
339+ guid_ss << endpoint.guid ;
340+
341+ const auto part_it = endpoint.specific_partitions .find (guid_ss.str ());
342+ if (part_it != endpoint.specific_partitions .end ())
343+ {
344+ bridge_it->second ->add_partition_to_topic (guid_ss.str (), part_it->second );
345+ }
346+ }
347+ }
348+ // update readers outside the lock
349+ // if (!filter_partition_.empty()) // TODO. danip
350+ // {
351+ // update_readers_track(endpoint.topic.m_topic_name, filter_partition_);
352+ // }
296353 }
297354}
298355
0 commit comments