try start software on new thread
MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -87,7 +87,10 @@ namespace WalletWasabi.Gui
TorManager = null;
TorManager = new TorProcessManager(Config.GetTorSocks5EndPoint(), TorLogsFile);
- TorManager.Start();
+ new Thread(delegate ()
+ {
+ TorManager.StartAsync(ensureRunning: false).GetAwaiter().GetResult();
+ }).Start();
Logger.LogInfo<TorProcessManager>($"Fake {nameof(TorProcessManager)} is initialized.");

MODIFY
WalletWasabi.Tests/LiveServerTests.cs
WalletWasabi.Tests/LiveServerTests.cs
@@ -29,12 +29,7 @@ namespace WalletWasabi.Tests
LiveServerTestsFixture = liveServerTestsFixture;
var torManager = new TorProcessManager(SharedFixture.TorSocks5Endpoint, SharedFixture.TorLogsFile);
- torManager.Start();
- Task.Delay(3000).GetAwaiter().GetResult();
- if (!torManager.IsTorRunningAsync().GetAwaiter().GetResult())
- {
- throw new Exception("Tor is not running");
- }
+ torManager.StartAsync(true).GetAwaiter().GetResult();
}
#region Blockchain

MODIFY
WalletWasabi.Tests/TorTests.cs
WalletWasabi.Tests/TorTests.cs
@@ -19,12 +19,7 @@ namespace WalletWasabi.Tests
{
SharedFixture = sharedFixture;
var torManager = new TorProcessManager(SharedFixture.TorSocks5Endpoint, SharedFixture.TorLogsFile);
- torManager.Start();
- Task.Delay(3000).GetAwaiter().GetResult();
- if (!torManager.IsTorRunningAsync().GetAwaiter().GetResult())
- {
- throw new Exception("Tor is not running");
- }
+ torManager.StartAsync(false).GetAwaiter().GetResult();
}
[Fact]

MODIFY
WalletWasabi/TorSocks5/TorProcessManager.cs
WalletWasabi/TorSocks5/TorProcessManager.cs
@@ -27,9 +27,7 @@ namespace WalletWasabi.TorSocks5
LogFile = logFile;
}
- public void Start()
- {
- Task.Run(async () =>
+ public async Task StartAsync(bool ensureRunning)
{
try
{
@@ -133,6 +131,8 @@ namespace WalletWasabi.TorSocks5
Logger.LogInfo<TorProcessManager>($"Started Tor process with shell command: {runTorCmd}.");
}
+ if (ensureRunning)
+ {
await Task.Delay(3000).ConfigureAwait(false); // dotnet brainfart, ConfigureAwait(false) IS NEEDED HERE otherwise (only on) Manjuro Linux fails, WTF?!!
if (!await IsTorRunningAsync(TorSocks5EndPoint))
{
@@ -140,6 +140,7 @@ namespace WalletWasabi.TorSocks5
}
Logger.LogInfo<TorProcessManager>("Tor is running.");
}
+ }
catch (Exception ex)
{
throw new TorException("Could not automatically start Tor. Try running Tor manually.", ex);
@@ -149,7 +150,6 @@ namespace WalletWasabi.TorSocks5
{
Logger.LogError<TorProcessManager>(ex);
}
- });
}
/// <param name="torSocks5EndPoint">Opt out Tor with null.</param>

try start software on new thread