From 18060987ef3952cedb6d49eb53197e04e2c761a5 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Tue, 23 Jun 2026 14:17:49 +0300 Subject: [PATCH] tor: inverse check skip send to send tor --- api/src/foreign.rs | 2 +- api/src/owner.rs | 4 ++-- config/src/types.rs | 8 ++++---- controller/src/command.rs | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api/src/foreign.rs b/api/src/foreign.rs index df1305c..32ec8b7 100644 --- a/api/src/foreign.rs +++ b/api/src/foreign.rs @@ -373,7 +373,7 @@ where Some(a) => { let tc = self.tor_config.lock(); let can_send = if let Some(tc) = tc.as_ref() { - tc.skip_send(None) + tc.send_tor(None) } else { false }; diff --git a/api/src/owner.rs b/api/src/owner.rs index 187fcd7..dc70277 100644 --- a/api/src/owner.rs +++ b/api/src/owner.rs @@ -677,7 +677,7 @@ where let tor_config_lock = self.tor_config.lock(); let tc = tor_config_lock.clone(); let can_send = if let Some(tc) = tc.as_ref() { - tc.skip_send(sa.skip_tor) + tc.send_tor(sa.skip_tor) } else { false }; @@ -837,7 +837,7 @@ where let tor_config_lock = self.tor_config.lock(); let tc = tor_config_lock.clone(); let can_send = if let Some(tc) = tc.as_ref() { - tc.skip_send(sa.skip_tor) + tc.send_tor(sa.skip_tor) } else { false }; diff --git a/config/src/types.rs b/config/src/types.rs index bd784c5..31e5ac4 100644 --- a/config/src/types.rs +++ b/config/src/types.rs @@ -195,12 +195,12 @@ impl Default for TorConfig { } impl TorConfig { - /// Check if attempt to send over Tor must be skipped using provided possible argument at priority. - pub fn skip_send(&self, skip_arg: Option) -> bool { + /// Check if attempt to send over Tor is needed using provided possible argument at priority. + pub fn send_tor(&self, skip_arg: Option) -> bool { if let Some(skip_tor) = skip_arg { - return skip_tor; + return !skip_tor; } - self.skip_send_attempt.unwrap_or(false) + !self.skip_send_attempt.unwrap_or(false) } } diff --git a/controller/src/command.rs b/controller/src/command.rs index b15f11d..cb3ae6e 100644 --- a/controller/src/command.rs +++ b/controller/src/command.rs @@ -450,7 +450,7 @@ where }; let can_send = if let Some(tc) = tor_config.as_ref() { - tc.skip_send(args.skip_tor) + tc.send_tor(args.skip_tor) } else { false }; @@ -707,7 +707,7 @@ where }; let can_send = if let Some(tc) = tor_config.as_ref() { - tc.skip_send(args.skip_tor) + tc.send_tor(args.skip_tor) } else { false }; @@ -1050,7 +1050,7 @@ where }; let can_send = if let Some(tc) = tor_config.as_ref() { - tc.skip_send(args.skip_tor) + tc.send_tor(args.skip_tor) } else { false };