Move KillRequsted to TerminateService
MODIFY
WalletWasabi.Gui/CommandLine/Daemon.cs
WalletWasabi.Gui/CommandLine/Daemon.cs
@@ -71,13 +71,13 @@ namespace WalletWasabi.Gui.CommandLine
Logger.LogInfo("Correct password.");
await Global.InitializeNoWalletAsync(TerminateService);
- if (Global.KillRequested)
+ if (TerminateService.IsTerminateRequested)
{
return;
}
Wallet = await Global.WalletManager.StartWalletAsync(keyManager);
- if (Global.KillRequested)
+ if (TerminateService.IsTerminateRequested)
{
return;
}
@@ -91,7 +91,7 @@ namespace WalletWasabi.Gui.CommandLine
do
{
- if (Global.KillRequested)
+ if (TerminateService.IsTerminateRequested)
{
break;
}
@@ -103,7 +103,7 @@ namespace WalletWasabi.Gui.CommandLine
await TryQueueCoinsToMixAsync(password, minAnonset: Wallet.ServiceConfiguration.GetMixUntilAnonymitySetValue());
}
- if (Global.KillRequested)
+ if (TerminateService.IsTerminateRequested)
{
break;
}
@@ -115,7 +115,7 @@ namespace WalletWasabi.Gui.CommandLine
await TryQueueCoinsToMixAsync(password, maxAnonset: Wallet.ServiceConfiguration.GetMixUntilAnonymitySetValue() - 1);
}
- if (Global.KillRequested)
+ if (TerminateService.IsTerminateRequested)
{
break;
}
@@ -128,7 +128,7 @@ namespace WalletWasabi.Gui.CommandLine
}
catch
{
- if (!Global.KillRequested)
+ if (!TerminateService.IsTerminateRequested)
{
throw;
}

MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -70,8 +70,6 @@ namespace WalletWasabi.Gui
public HostedServices HostedServices { get; }
- public bool KillRequested => false;
-
public UiConfig UiConfig { get; }
public Network Network => Config.Network;

MODIFY
WalletWasabi/Services/Terminate/TerminateService.cs
WalletWasabi/Services/Terminate/TerminateService.cs
@@ -72,6 +72,8 @@ namespace WalletWasabi.Services.Terminate
Environment.Exit(exitCode);
}
+ public bool IsTerminateRequested => Interlocked.Read(ref _terminateStatus) > TerminateStatusIdle;
+
private void Dispose()
{
AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit;

Move KillRequsted to TerminateService