diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-09-25 14:36:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-25 14:36:31 -0500 |
| commit | cabbd9c2fcb30c6194d25045dd4a9f4bdf6d6e4f (patch) | |
| tree | 883663596f57ac644c8e23a520fea8219588a060 /src/slskd/Core | |
| parent | 67bc4bed7726204bd373bd8e784dbb819cc2dadd (diff) | |
| parent | b6eebb3f6695c93bce44ceb17725b7342085ae16 (diff) | |
| download | slskd-cabbd9c2fcb30c6194d25045dd4a9f4bdf6d6e4f.tar.gz | |
Merge pull request #656 from slskd/cancel-scan
Add the ability to cancel a share scan
Diffstat (limited to 'src/slskd/Core')
| -rw-r--r-- | src/slskd/Core/API/Controllers/ApplicationController.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Core/State.cs | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs index ac8be802..7fb914e9 100644 --- a/src/slskd/Core/API/Controllers/ApplicationController.cs +++ b/src/slskd/Core/API/Controllers/ApplicationController.cs @@ -72,6 +72,7 @@ namespace slskd.Core.API [Authorize] public IActionResult Shutdown() { + Program.MasterCancellationTokenSource.Cancel(); Lifetime.StopApplication(); Task.Run(async () => @@ -91,6 +92,7 @@ namespace slskd.Core.API [Authorize] public IActionResult Restart() { + Program.MasterCancellationTokenSource.Cancel(); Process.Start(Process.GetCurrentProcess().MainModule.FileName, Environment.CommandLine); Lifetime.StopApplication(); diff --git a/src/slskd/Core/State.cs b/src/slskd/Core/State.cs index 1b798ad3..519f5345 100644 --- a/src/slskd/Core/State.cs +++ b/src/slskd/Core/State.cs @@ -104,6 +104,7 @@ namespace slskd public bool Scanning { get; init; } public bool Ready { get; init; } public bool Faulted { get; init; } + public bool Cancelled { get; init; } public double ScanProgress { get; init; } public int Directories { get; init; } public int Files { get; init; } @@ -126,6 +127,8 @@ namespace slskd /// </summary> public bool Faulted { get; init; } = false; + public bool Cancelled { get; init; } = false; + /// <summary> /// Gets the current fill progress. /// </summary> |
