From e3c21ac4be0d5448d533cdb9fa36a527adcd70d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Tue, 27 Sep 2022 19:29:47 -0700 Subject: [PATCH] fix: use the uds-gateway feature only to control the http uds endpoint The current code also turns off the grpc control endpoint, but we need to keep it available in all configurations. The fix in iroh-p2p/Cargo.toml makes it possible to build iroh-one or iroh-p2p without building the whole workspace. --- iroh-one/Cargo.toml | 6 ++++-- iroh-one/README.md | 2 +- iroh-one/src/main.rs | 12 ++---------- iroh-p2p/Cargo.toml | 2 +- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/iroh-one/Cargo.toml b/iroh-one/Cargo.toml index 0afc9fab61..0c95c729d8 100644 --- a/iroh-one/Cargo.toml +++ b/iroh-one/Cargo.toml @@ -27,9 +27,9 @@ iroh-rpc-types = {path = "../iroh-rpc-types", default-features = false} iroh-store = {path = "../iroh-store", default-features = false, features = ["rpc-mem"]} iroh-util = {path = "../iroh-util"} serde = {version = "1.0", features = ["derive"]} +tempdir = "0.3.7" tokio = {version = "1", features = ["macros", "rt-multi-thread", "process"]} tracing = "0.1.33" -tempdir = "0.3.7" [dev-dependencies] axum-macros = "0.2.0" # use #[axum_macros::debug_handler] for better error messages on handlers @@ -39,4 +39,6 @@ http = "0.2" default = ["rpc-mem", "rpc-grpc"] rpc-grpc = ["iroh-rpc-types/grpc", "iroh-rpc-client/grpc", "iroh-metrics/rpc-grpc"] rpc-mem = ["iroh-rpc-types/mem", "iroh-rpc-client/mem"] -uds-gateway = [] \ No newline at end of file +# uds-gateway controls whether http over uds is enabled. This is independent of the +# rpc-grpc control endpoint. +uds-gateway = [] diff --git a/iroh-one/README.md b/iroh-one/README.md index f9525fe448..86d62958ef 100644 --- a/iroh-one/README.md +++ b/iroh-one/README.md @@ -15,7 +15,7 @@ Single binary of iroh services (gateway, p2p, store) communicating via mem chann ### Features -- `uds-gateway` - enables the usage and binding of the gateway over UDS. +- `uds-gateway` - enables the usage and binding of the http gateway over UDS. ### Reference diff --git a/iroh-one/src/main.rs b/iroh-one/src/main.rs index fded91f5ee..7793b8481b 100644 --- a/iroh-one/src/main.rs +++ b/iroh-one/src/main.rs @@ -55,13 +55,6 @@ async fn main() -> Result<()> { (store_rpc, p2p_rpc) }; - #[cfg(not(feature = "uds-gateway"))] - let (rpc_addr, gw_sender) = Addr::new_mem(); - #[cfg(not(feature = "uds-gateway"))] - { - config.rpc_client.gateway_addr = Some(gw_sender); - } - config.synchronize_subconfigs(); config.metrics = metrics::metrics_config_with_compile_time_info(config.metrics); @@ -69,8 +62,7 @@ async fn main() -> Result<()> { let metrics_config = config.metrics.clone(); - #[cfg(feature = "uds-gateway")] - let rpc_addr = config + let gateway_rpc_addr = config .gateway .server_rpc_addr()? .ok_or_else(|| anyhow!("missing gateway rpc addr"))?; @@ -91,7 +83,7 @@ async fn main() -> Result<()> { ) .await?; - let handler = Core::new_with_state(rpc_addr, Arc::clone(&shared_state)).await?; + let handler = Core::new_with_state(gateway_rpc_addr, Arc::clone(&shared_state)).await?; let metrics_handle = iroh_metrics::MetricsHandle::new(metrics_config) .await diff --git a/iroh-p2p/Cargo.toml b/iroh-p2p/Cargo.toml index 8c905a3372..f95c2b93b0 100644 --- a/iroh-p2p/Cargo.toml +++ b/iroh-p2p/Cargo.toml @@ -21,7 +21,7 @@ lazy_static = "1.4" iroh-bitswap = { path = "../iroh-bitswap" } iroh-rpc-types = { path = "../iroh-rpc-types", default-features = false } iroh-rpc-client = { path = "../iroh-rpc-client", default-features = false } -tokio = { version = "1", features = ["time", "sync", "macros"] } +tokio = { version = "1", features = ["fs", "time", "sync", "macros"] } ahash = "0.7.6" tracing = "0.1.34" clap = { version = "3.1.14", features = ["derive"] }