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/Program.cs | |
| 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/Program.cs')
| -rw-r--r-- | src/slskd/Program.cs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index e828f242..03870f0a 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -30,6 +30,7 @@ namespace slskd using System.Security.Cryptography.X509Certificates; using System.Text; using System.Text.Json.Serialization; + using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; @@ -189,6 +190,16 @@ namespace slskd /// </summary> public static ConcurrentFixedSizeQueue<LogRecord> LogBuffer { get; } = new ConcurrentFixedSizeQueue<LogRecord>(size: 100); + /// <summary> + /// Gets the master cancellation token source for the program. + /// </summary> + /// <remarks> + /// The token from this source should be used (or linked) to any long-running asynchronous task, so that when the application + /// begins to shut down these tasks also shut down in a timely manner. Actions that control the lifecycle of the program + /// (POSIX signals, a restart from the API, etc) should cancel this source. + /// </remarks> + public static CancellationTokenSource MasterCancellationTokenSource { get; } = new CancellationTokenSource(); + private static IConfigurationRoot Configuration { get; set; } private static OptionsAtStartup OptionsAtStartup { get; } = new OptionsAtStartup(); private static ILogger Log { get; set; } = new ConsoleWriteLineLogger(); @@ -329,8 +340,10 @@ namespace slskd Log.Warning($"Please report any issues here: {IssuesUrl}"); } + Log.Information("System: .NET {DotNet}, {OS}, {BitNess} bit, {ProcessorCount} processors", Environment.Version, Environment.OSVersion, Environment.Is64BitOperatingSystem ? 64 : 32, Environment.ProcessorCount); + Log.Information("Process ID: {ProcessId} ({BitNess} bit)", ProcessId, Environment.Is64BitProcess ? 64 : 32); + Log.Information("Invocation ID: {InvocationId}", InvocationId); - Log.Information("Process ID: {ProcessId}", ProcessId); Log.Information("Instance Name: {InstanceName}", OptionsAtStartup.InstanceName); // SQLite must have specific capabilities to function properly. this shouldn't be a concern for shrinkwrapped |
