Fixed multiple subscriber on transient_local topic #723
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.
Public API Changes
None
Description
Problem: Only the first subscription to a transient_local topic does receive the "latched" data.
The MultiSubscriber class creates a new subscription to initially receive the "latched" data for each new client. After this subscription returns with a message the client is shifted over to the "real" subscription and the other one is destroyed. Because this intermittent subscribers does not use the same QoS settings as the real one it will never receive latched data from transient_local topics except there is send new data from the publisher.
Fix: This PR adds the QoS settings as a global variable to the MultiSubscriber class and uses it when creating intermittent subscribers for new clients. With the correct settings these will directly get back with the latched data.
The transient_local_publisher test is also changed to subscribe three times to cover this case.