Fix routing loop when 2 Subscribers for a same topic exist across 2 bridges #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In a setup with 2 interconnected bridges, with for instance one on domain 0 and the other one on domain 1:
if in domain 0 there are a Publisher and a Subscriber on a same topic
T
and in domain 1 a Subscriber on topicT
, then the Subscriber in domain 1 receives twice each publication.E.g. to reproduce on a single host:
ROS_DOMAIN_ID=0 ros2 run demo_nodes_cpp talker
ROS_DOMAIN_ID=0 ros2 run demo_nodes_cpp listener
ROS_DOMAIN_ID=0 zenoh-bridge-ros2dds
ROS_DOMAIN_ID=1 zenoh-bridge-ros2dds
ROS_DOMAIN_ID=1 ros2 run demo_nodes_cpp listener
The problem comes from bridge on domain 1 that re-publishes to DDS the data coming from bridge on domain 0, but also receives back this publication and route it back to the bridge on domain 0.
The cause is the DDS Writers (and DDS Readers) created by the bridge on a remote announcement of route copy the same declared QoS without adding the
ignore_local(Participant)
QoS. Adding this QoS will make the bridge to ignore its own publications over DDS, avoiding to route them back.This PR fixes that.