File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -275,21 +275,19 @@ class Publisher : public PublisherBase
275275 bool inter_process_publish_needed =
276276 get_subscription_count () > get_intra_process_subscription_count ();
277277
278- if (inter_process_publish_needed) {
278+ // If the publisher is configured with transient local durability, we must publish
279+ // inter-process. This ensures that the RMW stores the messages for late joiner subscriptions.
280+ // This has the consequence of subscriptions experiencing the double-delivery issue
281+ // mentioned in https://github.com/ros2/rclcpp/issues/1750
282+ if (inter_process_publish_needed || buffer_) {
279283 auto shared_msg =
280284 this ->do_intra_process_ros_message_publish_and_return_shared (std::move (msg));
281285 if (buffer_) {
282286 buffer_->add_shared (shared_msg);
283287 }
284288 this ->do_inter_process_publish (*shared_msg);
285289 } else {
286- if (buffer_) {
287- auto shared_msg =
288- this ->do_intra_process_ros_message_publish_and_return_shared (std::move (msg));
289- buffer_->add_shared (shared_msg);
290- } else {
291- this ->do_intra_process_ros_message_publish (std::move (msg));
292- }
290+ this ->do_intra_process_ros_message_publish (std::move (msg));
293291 }
294292 }
295293
You can’t perform that action at this time.
0 commit comments