From d73c36c607f84489b1e56849bbb58d4881effe8a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Sun, 2 Feb 2025 15:59:28 -0800 Subject: [PATCH] Inform users that peers will not discover and communicate with one another until the router is started (#440) (#445) * Inform users that peers will not discover and communicate with one another until the router is started Signed-off-by: Yadunund * Address feedback Signed-off-by: Yadunund --------- Signed-off-by: Yadunund (cherry picked from commit eccec54f2b5a79670cf8a78068f6acac193ccd50) Co-authored-by: yadunund --- rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp index e6198f3a..3e3d0b72 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -111,6 +111,15 @@ class rmw_context_impl_s::Data final : public std::enable_shared_from_this "Have you started a router with `ros2 run rmw_zenoh_cpp rmw_zenohd`?"); } if (++connection_attempts >= configured_connection_attempts.value()) { + RMW_ZENOH_LOG_WARN_NAMED( + "rmw_zenoh_cpp", + "Unable to connect to a Zenoh router after %zu attempt(s). " + "Please ensure that a Zenoh router is running and can be reached. " + "You may increase the number of attempts to check for a router by " + "setting the ZENOH_ROUTER_CHECK_ATTEMPTS environment variable. " + "Proceeding with initialization but other peers will not discover " + "or receive data from peers in this session until a router is started.", + configured_connection_attempts.value()); break; } std::this_thread::sleep_for(sleep_time);