diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-01-27 19:47:57 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-01-27 19:47:57 -0600 |
| commit | dab94cbdfe2b9db21a82f447c49ba2cc46800bbb (patch) | |
| tree | 8f2ae5f22417f86d31aca887ac06ca024962dce8 /src | |
| parent | b66ccf8ffa201c7acaaba5f4e512de3e1ddc694a (diff) | |
| download | slskd-dab94cbdfe2b9db21a82f447c49ba2cc46800bbb.tar.gz | |
revert application changes
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Application.cs | 48 |
1 files changed, 2 insertions, 46 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 3f4ae37f..bed8aab2 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -56,7 +56,6 @@ namespace slskd { public Task CheckVersionAsync(); public void CollectGarbage(); - public Task ApplyOptionsPatchAsync(OptionsPatch patch); } public sealed class Application : IApplication @@ -229,7 +228,6 @@ namespace slskd private ConcurrentDictionary<string, ILogger> Loggers { get; } = new ConcurrentDictionary<string, ILogger>(); private Options Options => OptionsMonitor.CurrentValue; private OptionsAtStartup OptionsAtStartup { get; set; } - private OptionsPatch OptionsPatch { get; set; } private IOptionsMonitor<Options> OptionsMonitor { get; set; } private SemaphoreSlim OptionsSyncRoot { get; } = new SemaphoreSlim(1, 1); private SemaphoreSlim GlobalEnqueueSemaphore { get; } = new SemaphoreSlim(10, 10); @@ -317,8 +315,6 @@ namespace slskd } } - public Task ApplyOptionsPatchAsync(OptionsPatch patch) => PatchOptions(patch); - async Task IHostedService.StartAsync(CancellationToken cancellationToken) { Log.Information("Application started"); @@ -1395,26 +1391,7 @@ namespace slskd } } - private Task OptionsMonitor_OnChange(Options newOptions) - { - return UpdateOptions(newOptions); - } - - private async Task PatchOptions(OptionsPatch patch) - { - await OptionsSyncRoot.WaitAsync(); - - try - { - OptionsPatch = patch; - } - finally - { - OptionsSyncRoot.Release(); - } - } - - private async Task UpdateOptions(Options newOptions) + private async Task OptionsMonitor_OnChange(Options newOptions) { // this code is known to fire more than once per update. i'm not sure whether these might be executed concurrently. // lock to be safe, because we need to accurately track the last value of Options for diffing purposes. threading @@ -1543,29 +1520,8 @@ namespace slskd inactivityTimeout: connection.Timeout.Transfer); } - /* - apply options from the run-time options patch - - if options are present (are not null), they take precedent over any other options, regardless of - how they were defined (command line, envar, yaml) - - this needs to be done for every single property in OptionsPatch, or the next time options are updated - the value may be overwritten - */ - IPAddress listenIPAddress = !string.IsNullOrEmpty(OptionsPatch?.Soulseek?.ListenIpAddress) - ? IPAddress.Parse(OptionsPatch.Soulseek.ListenIpAddress) - : old.ListenIpAddress == update.ListenIpAddress - ? null - : IPAddress.Parse(update.ListenIpAddress); - - int? listenPort = (OptionsPatch?.Soulseek?.ListenPort.HasValue ?? false) - ? OptionsPatch.Soulseek.ListenPort.Value - : old.ListenPort == update.ListenPort - ? null - : update.ListenPort; - var patch = new SoulseekClientOptionsPatch( - listenIPAddress: listenIPAddress, + listenIPAddress: old.ListenIpAddress == update.ListenIpAddress ? null : IPAddress.Parse(update.ListenIpAddress), listenPort: old.ListenPort == update.ListenPort ? null : update.ListenPort, enableDistributedNetwork: old.DistributedNetwork.Disabled == update.DistributedNetwork.Disabled ? null : !update.DistributedNetwork.Disabled, distributedChildLimit: old.DistributedNetwork.ChildLimit == update.DistributedNetwork.ChildLimit ? null : update.DistributedNetwork.ChildLimit, |
