diff options
| -rw-r--r-- | config/slskd.example.yml | 2 | ||||
| -rw-r--r-- | docs/config.md | 6 | ||||
| -rw-r--r-- | src/slskd/Core/Options.cs | 6 | ||||
| -rw-r--r-- | src/slskd/Transfers/Downloads/DownloadService.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Transfers/Types/RetryPartialStrategy.cs (renamed from src/slskd/Transfers/Types/RetryIncompleteStrategy.cs) | 8 |
5 files changed, 14 insertions, 12 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..8848060a 100644 --- a/docs/config.md +++ b/docs/config.md @@ -362,14 +362,16 @@ 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. + +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: 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; /// <summary> - /// Gets the strategy for handling incomplete files upon retry. + /// Gets the strategy for handling partial files upon retry. /// </summary> - [Enum(typeof(RetryIncompleteStrategy))] - public string Incomplete { get; init; } = RetryIncompleteStrategy.Overwrite.ToString().ToLowerInvariant(); + [Enum(typeof(RetryPartialStrategy))] + public string Partial { get; init; } = RetryPartialStrategy.Resume.ToString().ToLowerInvariant(); } } 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<RetryIncompleteStrategy>(); + var incompleteStrategy = retryOptions.Partial.ToEnum<RetryPartialStrategy>(); 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; diff --git a/src/slskd/Transfers/Types/RetryIncompleteStrategy.cs b/src/slskd/Transfers/Types/RetryPartialStrategy.cs index 9ac8d8e2..20868913 100644 --- a/src/slskd/Transfers/Types/RetryIncompleteStrategy.cs +++ b/src/slskd/Transfers/Types/RetryPartialStrategy.cs @@ -1,4 +1,4 @@ -// <copyright file="RetryIncompleteStrategy.cs" company="JP Dillingham"> +// <copyright file="RetryPartialStrategy.cs" company="JP Dillingham"> // ▄▄▄▄ ▄▄▄▄ ▄▄▄▄ // ▄▄▄▄▄▄█ █▄▄▄▄▄█ █▄▄▄▄▄█ █ // █__ --█ █__ --█ ◄█ - █ @@ -33,9 +33,9 @@ namespace slskd.Transfers; /// <summary> -/// Strategy for retrying incomplete files. +/// Strategy for retrying partial files. /// </summary> -public enum RetryIncompleteStrategy +public enum RetryPartialStrategy { /// <summary> /// Overwrite the existing file. @@ -43,7 +43,7 @@ public enum RetryIncompleteStrategy Overwrite = 0, /// <summary> - /// Resume the transfer using the size of the incomplete file as the initial offset. + /// Resume the transfer using the size of the partial file as the initial offset. /// </summary> Resume = 1, }
\ No newline at end of file |
