From 94d99c32aefc37e5da9856dfb5e67489f342aabb Mon Sep 17 00:00:00 2001 From: OlivierHecart Date: Mon, 2 Dec 2024 11:04:14 +0100 Subject: [PATCH 1/2] Change default config listen endpoints when transport_tcp feature is disabled --- commons/zenoh-config/Cargo.toml | 1 + commons/zenoh-config/src/defaults.rs | 6 ++++++ io/zenoh-link/Cargo.toml | 2 +- io/zenoh-transport/Cargo.toml | 2 +- zenoh/Cargo.toml | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/commons/zenoh-config/Cargo.toml b/commons/zenoh-config/Cargo.toml index 43472626d4..0a650d5d46 100644 --- a/commons/zenoh-config/Cargo.toml +++ b/commons/zenoh-config/Cargo.toml @@ -25,6 +25,7 @@ description = "Internal crate for zenoh." [features] internal = [] +transport_tcp = [] [dependencies] tracing = { workspace = true } diff --git a/commons/zenoh-config/src/defaults.rs b/commons/zenoh-config/src/defaults.rs index edf2c46c7f..da10d7b790 100644 --- a/commons/zenoh-config/src/defaults.rs +++ b/commons/zenoh-config/src/defaults.rs @@ -140,8 +140,14 @@ impl Default for ListenConfig { Self { timeout_ms: None, endpoints: ModeDependentValue::Dependent(ModeValues { + #[cfg(feature = "transport_tcp")] router: Some(vec!["tcp/[::]:7447".parse().unwrap()]), + #[cfg(not(feature = "transport_tcp"))] + router: Some(vec![]), + #[cfg(feature = "transport_tcp")] peer: Some(vec!["tcp/[::]:0".parse().unwrap()]), + #[cfg(not(feature = "transport_tcp"))] + peer: Some(vec![]), client: None, }), exit_on_failure: None, diff --git a/io/zenoh-link/Cargo.toml b/io/zenoh-link/Cargo.toml index 64f0dc053e..19f81c0f31 100644 --- a/io/zenoh-link/Cargo.toml +++ b/io/zenoh-link/Cargo.toml @@ -26,7 +26,7 @@ description = "Internal crate for zenoh." [features] transport_quic = ["zenoh-link-quic"] -transport_tcp = ["zenoh-link-tcp"] +transport_tcp = ["zenoh-link-tcp", "zenoh-config/transport_tcp"] transport_tls = ["zenoh-link-tls"] transport_udp = ["zenoh-link-udp"] transport_unixsock-stream = ["zenoh-link-unixsock_stream"] diff --git a/io/zenoh-transport/Cargo.toml b/io/zenoh-transport/Cargo.toml index 2fd74c8b0b..23dc24b433 100644 --- a/io/zenoh-transport/Cargo.toml +++ b/io/zenoh-transport/Cargo.toml @@ -36,7 +36,7 @@ auth_usrpwd = ["transport_auth"] transport_auth = [] transport_multilink = ["auth_pubkey"] transport_quic = ["zenoh-link/transport_quic"] -transport_tcp = ["zenoh-link/transport_tcp"] +transport_tcp = ["zenoh-link/transport_tcp", "zenoh-config/transport_tcp"] transport_tls = ["zenoh-link/transport_tls"] transport_udp = ["zenoh-link/transport_udp"] transport_unixsock-stream = ["zenoh-link/transport_unixsock-stream"] diff --git a/zenoh/Cargo.toml b/zenoh/Cargo.toml index 94f6d6eb48..ece72ab5c4 100644 --- a/zenoh/Cargo.toml +++ b/zenoh/Cargo.toml @@ -58,7 +58,7 @@ transport_compression = ["zenoh-transport/transport_compression"] transport_quic = ["zenoh-transport/transport_quic"] transport_serial = ["zenoh-transport/transport_serial"] transport_unixpipe = ["zenoh-transport/transport_unixpipe"] -transport_tcp = ["zenoh-transport/transport_tcp"] +transport_tcp = ["zenoh-transport/transport_tcp", "zenoh-config/transport_tcp"] transport_tls = ["zenoh-transport/transport_tls"] transport_udp = ["zenoh-transport/transport_udp"] transport_unixsock-stream = ["zenoh-transport/transport_unixsock-stream"] From 860498c0ab14d068e53ed29ea2fea3cc0270e837 Mon Sep 17 00:00:00 2001 From: OlivierHecart Date: Tue, 3 Dec 2024 15:46:38 +0100 Subject: [PATCH 2/2] Add warning when starting with no listener endpoints --- zenoh/src/net/runtime/orchestrator.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zenoh/src/net/runtime/orchestrator.rs b/zenoh/src/net/runtime/orchestrator.rs index 1ed468bbf9..bd3cf0a155 100644 --- a/zenoh/src/net/runtime/orchestrator.rs +++ b/zenoh/src/net/runtime/orchestrator.rs @@ -499,6 +499,10 @@ impl Runtime { } async fn bind_listeners(&self, listeners: &[EndPoint]) -> ZResult<()> { + if listeners.is_empty() { + tracing::warn!("Starting with no listener endpoints!"); + return Ok(()); + } let timeout = self.get_global_listener_timeout(); if timeout.is_zero() { self.bind_listeners_impl(listeners).await