From 0626e54b6adf3e3c14134cea85b8c25fd1eff28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Thu, 20 Jun 2024 14:59:13 +0100 Subject: [PATCH 1/2] make embedded NR/IPR ignore performance of the gateway --- gateway/src/node/mod.rs | 2 ++ service-providers/ip-packet-router/src/ip_packet_router.rs | 7 +++++++ service-providers/network-requester/src/core.rs | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/gateway/src/node/mod.rs b/gateway/src/node/mod.rs index 7fa387030d..6162f896d3 100644 --- a/gateway/src/node/mod.rs +++ b/gateway/src/node/mod.rs @@ -318,6 +318,7 @@ impl Gateway { .with_shutdown(shutdown) .with_custom_gateway_transceiver(Box::new(transceiver)) .with_wait_for_gateway(true) + .with_minimum_gateway_performance(0) .with_on_start(on_start_tx); if let Some(custom_mixnet) = &nr_opts.custom_mixnet_path { @@ -382,6 +383,7 @@ impl Gateway { .with_shutdown(shutdown) .with_custom_gateway_transceiver(Box::new(transceiver)) .with_wait_for_gateway(true) + .with_minimum_gateway_performance(0) .with_on_start(on_start_tx); if let Some(custom_mixnet) = &ip_opts.custom_mixnet_path { diff --git a/service-providers/ip-packet-router/src/ip_packet_router.rs b/service-providers/ip-packet-router/src/ip_packet_router.rs index 8321cddd35..780a550f1a 100644 --- a/service-providers/ip-packet-router/src/ip_packet_router.rs +++ b/service-providers/ip-packet-router/src/ip_packet_router.rs @@ -36,6 +36,7 @@ impl OnStartData { pub struct IpPacketRouter { #[allow(unused)] config: Config, + wait_for_gateway: bool, custom_topology_provider: Option>, custom_gateway_transceiver: Option>, @@ -79,6 +80,12 @@ impl IpPacketRouter { self } + #[must_use] + pub fn with_minimum_gateway_performance(mut self, minimum_gateway_performance: u8) -> Self { + self.config.base.debug.topology.minimum_gateway_performance = minimum_gateway_performance; + self + } + #[must_use] #[allow(unused)] pub fn with_on_start(mut self, on_start: oneshot::Sender) -> Self { diff --git a/service-providers/network-requester/src/core.rs b/service-providers/network-requester/src/core.rs index 01c395365c..8e3bd6a7c9 100644 --- a/service-providers/network-requester/src/core.rs +++ b/service-providers/network-requester/src/core.rs @@ -222,6 +222,12 @@ impl NRServiceProviderBuilder { self } + #[must_use] + pub fn with_minimum_gateway_performance(mut self, minimum_gateway_performance: u8) -> Self { + self.config.base.debug.topology.minimum_gateway_performance = minimum_gateway_performance; + self + } + #[must_use] // this is a false positive, this method is actually called when used as a library // but clippy complains about it when building the binary From d33baec79b0f2e89f40612c1c8e008f06b44b7b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Fri, 21 Jun 2024 10:30:16 +0100 Subject: [PATCH 2/2] clippy --- service-providers/network-requester/src/core.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service-providers/network-requester/src/core.rs b/service-providers/network-requester/src/core.rs index 8e3bd6a7c9..c0f2faf186 100644 --- a/service-providers/network-requester/src/core.rs +++ b/service-providers/network-requester/src/core.rs @@ -223,6 +223,9 @@ impl NRServiceProviderBuilder { } #[must_use] + // this is a false positive, this method is actually called when used as a library + // but clippy complains about it when building the binary + #[allow(unused)] pub fn with_minimum_gateway_performance(mut self, minimum_gateway_performance: u8) -> Self { self.config.base.debug.topology.minimum_gateway_performance = minimum_gateway_performance; self