diff --git a/core/archipelago/src/api/rpc/tor.rs b/core/archipelago/src/api/rpc/tor.rs index 741c5842..10f02e44 100644 --- a/core/archipelago/src/api/rpc/tor.rs +++ b/core/archipelago/src/api/rpc/tor.rs @@ -330,15 +330,24 @@ impl RpcHandler { info!(app = app_id, "Disabled Tor access — removed hidden service dir"); } - // Restart archy-tor to apply changes - let status = tokio::process::Command::new("sudo") - .args(["podman", "restart", "archy-tor"]) + // Restart Tor to apply changes — try system service first, then container + let system_ok = tokio::process::Command::new("sudo") + .args(["systemctl", "restart", "tor"]) .status() .await - .context("Failed to restart archy-tor")?; + .map(|s| s.success()) + .unwrap_or(false); - if !status.success() { - warn!("archy-tor restart failed after toggle"); + if !system_ok { + let container_ok = tokio::process::Command::new("sudo") + .args(["podman", "restart", "archy-tor"]) + .status() + .await + .map(|s| s.success()) + .unwrap_or(false); + if !container_ok { + warn!("Failed to restart Tor after toggle"); + } } // If enabling, wait for hostname to appear