Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Options/TransferOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Soulseek
using System;
using System.Threading;
using System.Threading.Tasks;
using Soulseek.Diagnostics;

/// <summary>
/// Options for transfer operations.
Expand Down Expand Up @@ -47,6 +48,9 @@ public class TransferOptions
/// The delegate, accepting the number of bytes attempted, granted, and transferred for each chunk, used to report
/// transfer statistics.
/// </param>
/// <param name="diagnostic">
/// The delegate to invoke when a diagnostic message for the transfer is captured.
/// </param>
/// <param name="maximumLingerTime">
/// The maximum linger time, in milliseconds, that a connection will attempt to cleanly close following a transfer.
/// </param>
Expand All @@ -66,6 +70,7 @@ public TransferOptions(
Func<Transfer, CancellationToken, Task> slotAwaiter = null,
Action<Transfer> slotReleased = null,
Action<Transfer, int, int, int> reporter = null,
Action<(DateTime timestamp, DiagnosticLevel Level, string Message, Exception exception)> diagnostic = null,
int maximumLingerTime = 3000,
bool seekInputStreamAutomatically = true,
bool disposeInputStreamOnCompletion = true,
Expand All @@ -78,12 +83,18 @@ public TransferOptions(
SlotAwaiter = slotAwaiter ?? defaultSlotAwaiter;
SlotReleased = slotReleased;
Reporter = reporter;
Diagnostic = diagnostic;

StateChanged = stateChanged;
ProgressUpdated = progressUpdated;
MaximumLingerTime = maximumLingerTime;
}

/// <summary>
/// Gets the delegate to invoke when a diagnostic message for the transfer is captured.
/// </summary>
public Action<(DateTime Timestamp, DiagnosticLevel Level, string Message, Exception Exception)> Diagnostic { get; }

/// <summary>
/// Gets a value indicating whether input streams should be closed upon transfer completion. (Default = false).
/// </summary>
Expand Down Expand Up @@ -156,6 +167,7 @@ public TransferOptions WithAdditionalStateChanged(Action<(TransferStates Previou
slotAwaiter: SlotAwaiter,
slotReleased: SlotReleased,
reporter: Reporter,
diagnostic: Diagnostic,
maximumLingerTime: MaximumLingerTime,
seekInputStreamAutomatically: SeekInputStreamAutomatically,
disposeInputStreamOnCompletion: DisposeInputStreamOnCompletion,
Expand Down Expand Up @@ -183,6 +195,7 @@ public TransferOptions WithDisposalOptions(
slotAwaiter: SlotAwaiter,
slotReleased: SlotReleased,
reporter: Reporter,
diagnostic: Diagnostic,
maximumLingerTime: MaximumLingerTime,
seekInputStreamAutomatically: SeekInputStreamAutomatically,
disposeInputStreamOnCompletion: disposeInputStreamOnCompletion ?? DisposeInputStreamOnCompletion,
Expand Down
Loading