Kill Tor process
MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -759,7 +759,7 @@ namespace WalletWasabi.Gui
var torManager = TorManager;
if (torManager is { })
{
- await torManager.StopAsync().ConfigureAwait(false);
+ await torManager.StopAsync(Config.CloseTor).ConfigureAwait(false);
Logger.LogInfo($"{nameof(TorManager)} is stopped.");
}

MODIFY
WalletWasabi/Tor/TorProcessManager.cs
WalletWasabi/Tor/TorProcessManager.cs
@@ -233,7 +233,7 @@ namespace WalletWasabi.Tor
});
}
- public async Task StopAsync()
+ public async Task StopAsync(bool killTor = false)
{
Interlocked.CompareExchange(ref _monitorState, StateStopping, StateRunning); // If running, make it stopping.
@@ -249,9 +249,19 @@ namespace WalletWasabi.Tor
}
Stop?.Dispose();
Stop = null;
- TorProcess?.Dispose();
+
+ if (TorProcess is { } && killTor)
+ {
+ Logger.LogInfo($"Killing Tor process.");
+
+ TorProcess.Kill();
+ using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(1));
+ await TorProcess.WaitForExitAsync(cts.Token, true).ConfigureAwait(false);
+
+ TorProcess.Dispose();
TorProcess = null;
}
+ }
#endregion Monitor
}

Kill Tor process