TorSettings: Add TerminateOnExit property.
MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -3,7 +3,6 @@ using Microsoft.Extensions.Caching.Memory;
using NBitcoin;
using NBitcoin.Protocol;
using NBitcoin.Protocol.Behaviors;
-using NBitcoin.Protocol.Connectors;
using System;
using System.IO;
using System.Linq;
@@ -34,7 +33,6 @@ using WalletWasabi.Services;
using WalletWasabi.Services.Terminate;
using WalletWasabi.Stores;
using WalletWasabi.Tor;
-using WalletWasabi.Tor.Socks5;
using WalletWasabi.Wallets;
using WalletWasabi.WebClients.BlockstreamInfo;
using WalletWasabi.WebClients.Wasabi;
@@ -86,7 +84,7 @@ namespace WalletWasabi.Gui
DataDir = dataDir;
Config = config;
UiConfig = uiConfig;
- TorSettings = new TorSettings(DataDir, torLogsFile, distributionFolderPath: EnvironmentHelpers.GetFullBaseDirectory());
+ TorSettings = new TorSettings(DataDir, torLogsFile, distributionFolderPath: EnvironmentHelpers.GetFullBaseDirectory(), Config.TerminateTorOnExit);
HostedServices = new HostedServices();
WalletManager = walletManager;
@@ -487,7 +485,7 @@ namespace WalletWasabi.Gui
if (TorManager is { } torManager)
{
- await torManager.StopAsync(Config.TerminateTorOnExit).ConfigureAwait(false);
+ await torManager.StopAsync().ConfigureAwait(false);
Logger.LogInfo($"{nameof(TorManager)} is stopped.");
}

MODIFY
WalletWasabi.Tests/Helpers/Common.cs
WalletWasabi.Tests/Helpers/Common.cs
@@ -29,7 +29,7 @@ namespace WalletWasabi.Tests.Helpers
public static EndPoint TorSocks5Endpoint => new IPEndPoint(IPAddress.Loopback, 9050);
public static string TorLogsFile => Path.Combine(DataDir, "TorLogs.txt");
public static string TorDistributionFolder => Path.Combine(EnvironmentHelpers.GetFullBaseDirectory(), "TorDaemons");
- public static TorSettings TorSettings => new(DataDir, TorLogsFile, TorDistributionFolder);
+ public static TorSettings TorSettings => new(DataDir, TorLogsFile, TorDistributionFolder, terminateOnExit: false);
public static string DataDir => EnvironmentHelpers.GetDataDir(Path.Combine("WalletWasabi", "Tests"));

MODIFY
WalletWasabi/Tor/TorSettings.cs
WalletWasabi/Tor/TorSettings.cs
@@ -16,7 +16,7 @@ namespace WalletWasabi.Tor
/// <param name="dataDir">Application data directory.</param>
/// <param name="logFilePath">Full Tor log file path.</param>
/// <param name="distributionFolderPath">Full path to folder containing Tor installation files.</param>
- public TorSettings(string dataDir, string logFilePath, string distributionFolderPath)
+ public TorSettings(string dataDir, string logFilePath, string distributionFolderPath, bool terminateOnExit)
{
TorBinaryFilePath = GetTorBinaryFilePath();
TorBinaryDir = Path.Combine(MicroserviceHelpers.GetBinaryFolder(), "Tor");
@@ -25,7 +25,7 @@ namespace WalletWasabi.Tor
LogFilePath = logFilePath;
IoHelpers.EnsureContainingDirectoryExists(LogFilePath);
DistributionFolder = distributionFolderPath;
-
+ TerminateOnExit = terminateOnExit;
GeoIpPath = Path.Combine(DistributionFolder, "Tor", "Geoip", "geoip");
GeoIp6Path = Path.Combine(DistributionFolder, "Tor", "Geoip", "geoip6");
}
@@ -42,6 +42,9 @@ namespace WalletWasabi.Tor
/// <summary>Full Tor distribution folder where Tor installation files are located.</summary>
public string DistributionFolder { get; }
+ /// <summary>Whether Tor should be terminated when Wasabi Wallet terminates.</summary>
+ public bool TerminateOnExit { get; }
+
/// <summary>Full path to executable file that is used to start Tor process.</summary>
public string TorBinaryFilePath { get; }

TorSettings: Add TerminateOnExit property.