diff --git a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp index 6f2a9284..e5dfedca 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp @@ -147,10 +147,12 @@ std::shared_ptr PublisherData::make( if (adapted_qos_profile.reliability == RMW_QOS_POLICY_RELIABILITY_RELIABLE) { opts.reliability = Z_RELIABILITY_RELIABLE; - - if (adapted_qos_profile.history == RMW_QOS_POLICY_HISTORY_KEEP_ALL) { - opts.congestion_control = Z_CONGESTION_CONTROL_BLOCK; - } + // Note: Unlike DDS which blocks the Publisher only if QoS is RELIABLE + KEEP_ALL, + // we configure Zenoh to block for any RELIABLE Publisher. + // The reason being that over congested networks (where Zenoh is often used) the default + // behaviour would often lead to message losses, which could be problematic in the + // case of a "latched topic" (RELIABLE, TRANSIENT_LOCAL, KEEP_LAST(1), only 1 publication) + opts.congestion_control = Z_CONGESTION_CONTROL_BLOCK; } z_owned_publisher_t pub; // TODO(clalancette): What happens if the key name is a valid but empty string? diff --git a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp index 74cf1668..d6f7770c 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp @@ -34,7 +34,10 @@ void create_map_and_set_sequence_num( } ///============================================================================= -ZenohQuery::ZenohQuery(const z_loaned_query_t * query, std::chrono::nanoseconds::rep received_timestamp) { +ZenohQuery::ZenohQuery( + const z_loaned_query_t * query, + std::chrono::nanoseconds::rep received_timestamp) +{ z_query_clone(&query_, query); received_timestamp_ = received_timestamp; }