From c03c5087aa6ac70491363b7dff05909f7bc64fe0 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 24 May 2026 12:52:16 -0500 Subject: rename 'incomplete' to 'partial', default to 'resume' (to match docs) --- config/slskd.example.yml | 2 +- docs/config.md | 4 ++-- src/slskd/Core/Options.cs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/slskd.example.yml b/config/slskd.example.yml index e68baae2..1063e7f5 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -74,7 +74,7 @@ # slots: 500 # speed_limit: 1000 # retry: -# incomplete: resume # 'overwrite' or 'resume' +# partial: resume # 'overwrite' or 'resume' # attempts: 3 # delay: 5000 # initial time between retries, in milliseconds # max_delay: 60000 # maximum time between retries, in milliseconds diff --git a/docs/config.md b/docs/config.md index 14f1ae24..40d3a78a 100644 --- a/docs/config.md +++ b/docs/config.md @@ -362,14 +362,14 @@ transfers: Failed downloads can be retried automatically up to the configured number of attempts. If an attempt fails initially, the application delays the second attempt by the configured delay, and an exponential backoff is used to compute the delay for all subsequent events, up to the configured maximum delay. -By default, partial downloads are resumed based on the size of the incomplete file. Users can choose to always overwrite files if they wish. +By default, partial downloads are resumed based on the size of the file on disk. Users can choose to always overwrite files if they wish. **YAML** ```yaml transfers: download: retry: - incomplete: resume # 'overwrite' or 'resume' + partial: resume # 'overwrite' or 'resume' attempts: 3 delay: 5000 # initial time between retries, in milliseconds max_delay: 60000 # maximum time between retries, in milliseconds diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 83e534a1..bac86ea2 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1052,10 +1052,10 @@ namespace slskd public int MaxDelay { get; init; } = 60_000; /// - /// Gets the strategy for handling incomplete files upon retry. + /// Gets the strategy for handling partial files upon retry. /// - [Enum(typeof(RetryIncompleteStrategy))] - public string Incomplete { get; init; } = RetryIncompleteStrategy.Overwrite.ToString().ToLowerInvariant(); + [Enum(typeof(RetryPartialStrategy))] + public string Partial { get; init; } = RetryPartialStrategy.Resume.ToString().ToLowerInvariant(); } } -- cgit v1.2.3 From 8b27a264869dd51f3bb1ae27f208a3843d4c7df0 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 24 May 2026 12:54:00 -0500 Subject: rename RetryIncompleteStrategy to RetryPartialStrategy --- .../Transfers/Types/RetryIncompleteStrategy.cs | 49 ---------------------- src/slskd/Transfers/Types/RetryPartialStrategy.cs | 49 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 src/slskd/Transfers/Types/RetryIncompleteStrategy.cs create mode 100644 src/slskd/Transfers/Types/RetryPartialStrategy.cs diff --git a/src/slskd/Transfers/Types/RetryIncompleteStrategy.cs b/src/slskd/Transfers/Types/RetryIncompleteStrategy.cs deleted file mode 100644 index 9ac8d8e2..00000000 --- a/src/slskd/Transfers/Types/RetryIncompleteStrategy.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -// ▄▄▄▄ ▄▄▄▄ ▄▄▄▄ -// ▄▄▄▄▄▄█ █▄▄▄▄▄█ █▄▄▄▄▄█ █ -// █__ --█ █__ --█ ◄█ - █ -// █▄▄▄▄▄█▄▄█▄▄▄▄▄█▄▄█▄▄█▄▄▄▄▄█ -// ┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━ ━ ━┉ ┉ ┉ -// │ Copyright (c) JP Dillingham. -// │ -// │ This program is free software: you can redistribute it and/or modify -// │ it under the terms of the GNU Affero General Public License as published -// │ by the Free Software Foundation, version 3. -// │ -// │ This program is distributed in the hope that it will be useful, -// │ but WITHOUT ANY WARRANTY; without even the implied warranty of -// │ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// │ GNU Affero General Public License for more details. -// │ -// │ You should have received a copy of the GNU Affero General Public License -// │ along with this program. If not, see https://www.gnu.org/licenses/. -// │ -// │ This program is distributed with Additional Terms pursuant to Section 7 -// │ of the AGPLv3. See the LICENSE file in the root directory of this -// │ project for the complete terms and conditions. -// │ -// │ https://slskd.org -// │ -// ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ╌ ╌╌╌╌ ╌ -// │ SPDX-FileCopyrightText: JP Dillingham -// │ SPDX-License-Identifier: AGPL-3.0-only -// ╰───────────────────────────────────────────╶──── ─ ─── ─ ── ──┈ ┈ -// - -namespace slskd.Transfers; - -/// -/// Strategy for retrying incomplete files. -/// -public enum RetryIncompleteStrategy -{ - /// - /// Overwrite the existing file. - /// - Overwrite = 0, - - /// - /// Resume the transfer using the size of the incomplete file as the initial offset. - /// - Resume = 1, -} \ No newline at end of file diff --git a/src/slskd/Transfers/Types/RetryPartialStrategy.cs b/src/slskd/Transfers/Types/RetryPartialStrategy.cs new file mode 100644 index 00000000..20868913 --- /dev/null +++ b/src/slskd/Transfers/Types/RetryPartialStrategy.cs @@ -0,0 +1,49 @@ +// +// ▄▄▄▄ ▄▄▄▄ ▄▄▄▄ +// ▄▄▄▄▄▄█ █▄▄▄▄▄█ █▄▄▄▄▄█ █ +// █__ --█ █__ --█ ◄█ - █ +// █▄▄▄▄▄█▄▄█▄▄▄▄▄█▄▄█▄▄█▄▄▄▄▄█ +// ┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━ ━ ━┉ ┉ ┉ +// │ Copyright (c) JP Dillingham. +// │ +// │ This program is free software: you can redistribute it and/or modify +// │ it under the terms of the GNU Affero General Public License as published +// │ by the Free Software Foundation, version 3. +// │ +// │ This program is distributed in the hope that it will be useful, +// │ but WITHOUT ANY WARRANTY; without even the implied warranty of +// │ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// │ GNU Affero General Public License for more details. +// │ +// │ You should have received a copy of the GNU Affero General Public License +// │ along with this program. If not, see https://www.gnu.org/licenses/. +// │ +// │ This program is distributed with Additional Terms pursuant to Section 7 +// │ of the AGPLv3. See the LICENSE file in the root directory of this +// │ project for the complete terms and conditions. +// │ +// │ https://slskd.org +// │ +// ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ╌ ╌╌╌╌ ╌ +// │ SPDX-FileCopyrightText: JP Dillingham +// │ SPDX-License-Identifier: AGPL-3.0-only +// ╰───────────────────────────────────────────╶──── ─ ─── ─ ── ──┈ ┈ +// + +namespace slskd.Transfers; + +/// +/// Strategy for retrying partial files. +/// +public enum RetryPartialStrategy +{ + /// + /// Overwrite the existing file. + /// + Overwrite = 0, + + /// + /// Resume the transfer using the size of the partial file as the initial offset. + /// + Resume = 1, +} \ No newline at end of file -- cgit v1.2.3 From 5b6acb312f4e59a03064b56d627b0fad96fb9165 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 24 May 2026 13:09:39 -0500 Subject: clarify risk of resume --- docs/config.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/config.md b/docs/config.md index 40d3a78a..8848060a 100644 --- a/docs/config.md +++ b/docs/config.md @@ -364,6 +364,8 @@ Failed downloads can be retried automatically up to the configured number of att By default, partial downloads are resumed based on the size of the file on disk. Users can choose to always overwrite files if they wish. +Incomplete files are stored in subdirectories including the remote user's username and the name of the containing directory on the remote user's PC, which minimizes (but does not completely eliminate!) the risk that a partial file is resumed incorrectly. Choosing to always overwrite files eliminates this risk but is less efficient and it increases the risk that the file will fail to fully transfer successfully. + **YAML** ```yaml transfers: -- cgit v1.2.3 From 98b81975d0bf7a10fc834d33d5bfbb6532f75686 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 24 May 2026 13:10:02 -0500 Subject: update partial call sites --- src/slskd/Transfers/Downloads/DownloadService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index 83e91ced..013e6a7a 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -1061,14 +1061,14 @@ namespace slskd.Transfers.Downloads var completedTransfer = await Retry.Do(() => { var incompleteFileInfo = Files.ResolveFileInfo(incompleteFilename); - var incompleteStrategy = retryOptions.Incomplete.ToEnum(); + var incompleteStrategy = retryOptions.Partial.ToEnum(); var shouldResume = false; var startOffset = 0L; if (incompleteFileInfo.Exists && incompleteFileInfo.Length > 0) { - if (incompleteStrategy == RetryIncompleteStrategy.Resume) + if (incompleteStrategy == RetryPartialStrategy.Resume) { shouldResume = true; startOffset = incompleteFileInfo.Length; -- cgit v1.2.3