From db73de70aa1e3d28707da66271b9962046ebcc8c Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 24 Sep 2022 16:21:20 -0500 Subject: cancel master token on shutdown and reboot --- src/slskd/Core/API/Controllers/ApplicationController.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/slskd/Core') 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(); -- cgit v1.2.3 From 196b88f9970887cbe69d1f0b7d23493204ce5990 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 24 Sep 2022 16:21:40 -0500 Subject: add cancelled to share state --- src/slskd/Core/State.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/slskd/Core') 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 /// public bool Faulted { get; init; } = false; + public bool Cancelled { get; init; } = false; + /// /// Gets the current fill progress. /// -- cgit v1.2.3