aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-11-23 16:14:00 -0600
committerJP Dillingham <jp@dillingham.me>2022-11-23 16:14:00 -0600
commit40dd7d8d569a8b3fa1af3975f011e81134d6188a (patch)
treeb323ccf1eda55ee4a3760f64f84d333f4d2f4b02 /src
parent6f3f37d5efb2707cb2067961b2215a46c675c22f (diff)
downloadslskd-40dd7d8d569a8b3fa1af3975f011e81134d6188a.tar.gz
pass start offset to agent
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Relay/API/Hubs/RelayHub.cs3
-rw-r--r--src/slskd/Relay/RelayService.cs8
2 files changed, 7 insertions, 4 deletions
diff --git a/src/slskd/Relay/API/Hubs/RelayHub.cs b/src/slskd/Relay/API/Hubs/RelayHub.cs
index 885ba453..b76f67b9 100644
--- a/src/slskd/Relay/API/Hubs/RelayHub.cs
+++ b/src/slskd/Relay/API/Hubs/RelayHub.cs
@@ -50,9 +50,10 @@ namespace slskd.Relay
/// Requests the specified <paramref name="filename"/> from the agent.
/// </summary>
/// <param name="filename">The name of the file.</param>
+ /// <param name="startOffset">The starting offset for the transfer.</param>
/// <param name="id">The unique identifier for the request.</param>
/// <returns>The operation context.</returns>
- Task RequestFileUpload(string filename, Guid id);
+ Task RequestFileUpload(string filename, long startOffset, Guid id);
}
/// <summary>
diff --git a/src/slskd/Relay/RelayService.cs b/src/slskd/Relay/RelayService.cs
index 3b872816..c4fb13a9 100644
--- a/src/slskd/Relay/RelayService.cs
+++ b/src/slskd/Relay/RelayService.cs
@@ -143,11 +143,12 @@ namespace slskd.Relay
/// </remarks>
/// <param name="agentName">The agent from which to retrieve the file.</param>
/// <param name="filename">The file to retrieve.</param>
+ /// <param name="startOffset">The starting offset for the transfer.</param>
/// <param name="id">A unique ID for the stream.</param>
/// <param name="timeout">An optional timeout value.</param>
/// <param name="cancellationToken">An optional token to monitor for cancellation requests.</param>
/// <returns>The operation context, including a stream containing the requested file.</returns>
- Task<Stream> GetFileStreamAsync(string agentName, string filename, Guid id, int timeout = 3000, CancellationToken cancellationToken = default);
+ Task<Stream> GetFileStreamAsync(string agentName, string filename, long startOffset, Guid id, int timeout = 3000, CancellationToken cancellationToken = default);
/// <summary>
/// Handles the client response for a <see cref="GetFileInfoAsync"/> request.
@@ -444,11 +445,12 @@ namespace slskd.Relay
/// </remarks>
/// <param name="agentName">The agent from which to retrieve the file.</param>
/// <param name="filename">The file to retrieve.</param>
+ /// <param name="startOffset">The starting offset for the transfer.</param>
/// <param name="id">A unique ID for the stream.</param>
/// <param name="timeout">An optional timeout value.</param>
/// <param name="cancellationToken">An optional token to monitor for cancellation requests.</param>
/// <returns>The operation context, including a stream containing the requested file.</returns>
- public async Task<Stream> GetFileStreamAsync(string agentName, string filename, Guid id, int timeout = 3000, CancellationToken cancellationToken = default)
+ public async Task<Stream> GetFileStreamAsync(string agentName, string filename, long startOffset, Guid id, int timeout = 3000, CancellationToken cancellationToken = default)
{
if (!RegisteredAgentDictionary.TryGetValue(agentName, out var record))
{
@@ -468,7 +470,7 @@ namespace slskd.Relay
Log.Information("Created wait {Key}", key);
- await RelayHub.Clients.Client(record.ConnectionId).RequestFileUpload(filename, id);
+ await RelayHub.Clients.Client(record.ConnectionId).RequestFileUpload(filename, startOffset, id);
Log.Information("Requested file {Filename} from Agent {Agent} with ID {Id}. Waiting for incoming connection.", filename, agentName, id);
var task = await Task.WhenAny(wait, Task.Delay(timeout, cancellationToken));