From 641e542a6301f1bb1d76093166f33395092492af Mon Sep 17 00:00:00 2001
From: Yadunund <yadunund@openrobotics.org>
Date: Fri, 5 Jan 2024 00:56:47 +0800
Subject: [PATCH] Set channel bound to 0 for zc_liveliness_get

Signed-off-by: Yadunund <yadunund@openrobotics.org>
---
 rmw_zenoh_cpp/src/rmw_init.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/rmw_zenoh_cpp/src/rmw_init.cpp b/rmw_zenoh_cpp/src/rmw_init.cpp
index 1e6da94c..201118c6 100644
--- a/rmw_zenoh_cpp/src/rmw_init.cpp
+++ b/rmw_zenoh_cpp/src/rmw_init.cpp
@@ -255,7 +255,11 @@ rmw_init(const rmw_init_options_t * options, rmw_context_t * context)
     "Sending Query '%s' to fetch discovery data...",
     liveliness_str.c_str()
   );
-  z_owned_reply_channel_t channel = zc_reply_fifo_new(16);
+  // Without setting the bound value to 0, the liveliness get call
+  // block execution where there are more than 3 nodes in the graph.
+  // From the zenoh-c documentation: If `bound` is different from 0, that channel will be bound and apply back-pressure when full.
+  // TODO(Yadunund): Investigate why this is the case and try switching to callbacks instead.
+  z_owned_reply_channel_t channel = zc_reply_fifo_new(0);
   zc_liveliness_get(
     z_loan(context->impl->session), z_keyexpr(liveliness_str.c_str()),
     z_move(channel.send), NULL);