From 358716cfb26f5ee76f09082bf835d7e144744c70 Mon Sep 17 00:00:00 2001 From: ChenYing Kuo Date: Fri, 22 Nov 2024 18:11:17 +0800 Subject: [PATCH 1/3] Enable CongestionControl::Block if QoS is reliable. Signed-off-by: ChenYing Kuo --- rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp index 6f2a9284..0ffdd86e 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp @@ -147,10 +147,7 @@ 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; - } + 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? From 3503c4713bd560d09f7048305be6e2508325558e Mon Sep 17 00:00:00 2001 From: Julien Enoch Date: Fri, 22 Nov 2024 12:08:36 +0100 Subject: [PATCH 2/3] add comment --- rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp index 0ffdd86e..e5dfedca 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp @@ -147,6 +147,11 @@ std::shared_ptr PublisherData::make( if (adapted_qos_profile.reliability == RMW_QOS_POLICY_RELIABILITY_RELIABLE) { opts.reliability = Z_RELIABILITY_RELIABLE; + // 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; From 64469458694a7340a39ae50b7f35d3113009d4cc Mon Sep 17 00:00:00 2001 From: Julien Enoch Date: Fri, 22 Nov 2024 12:13:06 +0100 Subject: [PATCH 3/3] fix uncrustify issue --- rmw_zenoh_cpp/src/detail/zenoh_utils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; }