aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-01-24 08:08:40 -0600
committerJP Dillingham <jpdillingham@gmail.com>2022-01-24 08:08:40 -0600
commite039221926b192d2de0d164c8641dba5e4908c2f (patch)
tree0365e1ac30de219be5f9aab33d90bbc2a3432a27 /src
parent15b057abf23778ec8bf595ccf4d773373510200a (diff)
downloadslskd-e039221926b192d2de0d164c8641dba5e4908c2f.tar.gz
reconfigure options if globals change
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index 73818c09..f2d81471 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -255,6 +255,8 @@ namespace slskd
distributedChildLimit: OptionsAtStartup.Soulseek.DistributedNetwork.ChildLimit,
enableDistributedNetwork: !OptionsAtStartup.Soulseek.DistributedNetwork.Disabled,
acceptDistributedChildren: !OptionsAtStartup.Soulseek.DistributedNetwork.DisableChildren,
+ maximumUploadSpeed: OptionsAtStartup.Global.Upload.SpeedLimit,
+ maximumDownloadSpeed: OptionsAtStartup.Global.Download.SpeedLimit,
autoAcknowledgePrivateMessages: false,
acceptPrivateRoomInvitations: true,
serverConnectionOptions: serverOptions,
@@ -545,7 +547,7 @@ namespace slskd
// create a new cancellation token source so that we can cancel the upload from the UI.
var cts = new CancellationTokenSource();
- var topts = new TransferOptions(stateChanged: (e) => tracker.AddOrUpdate(e, cts), progressUpdated: (e) => tracker.AddOrUpdate(e, cts), governor: (t, c) => Task.Delay(1, c));
+ var topts = new TransferOptions(stateChanged: (e) => tracker.AddOrUpdate(e, cts), progressUpdated: (e) => tracker.AddOrUpdate(e, cts));
// accept all download requests, and begin the upload immediately. normally there would be an internal queue, and
// uploads would be handled separately.
@@ -619,8 +621,9 @@ namespace slskd
// determine whether any Soulseek options changed. if so, we need to construct a patch and invoke ReconfigureOptionsAsync().
var slskDiff = PreviousOptions.Soulseek.DiffWith(newOptions.Soulseek);
+ var globalDiff = PreviousOptions.Global.DiffWith(newOptions.Global);
- if (slskDiff.Any())
+ if (slskDiff.Any() || globalDiff.Any())
{
var old = PreviousOptions.Soulseek;
var update = newOptions.Soulseek;
@@ -681,6 +684,8 @@ namespace slskd
enableDistributedNetwork: old.DistributedNetwork.Disabled == update.DistributedNetwork.Disabled ? null : !update.DistributedNetwork.Disabled,
distributedChildLimit: old.DistributedNetwork.ChildLimit == update.DistributedNetwork.ChildLimit ? null : update.DistributedNetwork.ChildLimit,
acceptDistributedChildren: old.DistributedNetwork.DisableChildren == update.DistributedNetwork.DisableChildren ? null : !update.DistributedNetwork.DisableChildren,
+ maximumUploadSpeed: newOptions.Global.Upload.SpeedLimit,
+ maximumDownloadSpeed: newOptions.Global.Download.SpeedLimit,
serverConnectionOptions: serverPatch,
peerConnectionOptions: connectionPatch,
transferConnectionOptions: transferPatch,