From 919e67bf7f9474e93f9a54f9ee83d789abd485e7 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 23 Nov 2022 16:07:35 -0600 Subject: log full exception --- src/slskd/Relay/API/Controllers/RelayController.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/slskd/Relay/API') diff --git a/src/slskd/Relay/API/Controllers/RelayController.cs b/src/slskd/Relay/API/Controllers/RelayController.cs index d6f4f840..ae87969e 100644 --- a/src/slskd/Relay/API/Controllers/RelayController.cs +++ b/src/slskd/Relay/API/Controllers/RelayController.cs @@ -134,6 +134,8 @@ namespace slskd.Relay catch (Exception ex) { Log.Warning("Failed to handle file upload for token {Token} from a caller claiming to be agent {Agent}: {Message}", token, agentName, ex.Message); + Log.Debug(ex, "Failed to handle file upload"); + return BadRequest(); } -- cgit v1.2.3 From 40dd7d8d569a8b3fa1af3975f011e81134d6188a Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 23 Nov 2022 16:14:00 -0600 Subject: pass start offset to agent --- src/slskd/Relay/API/Hubs/RelayHub.cs | 3 ++- src/slskd/Relay/RelayService.cs | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/slskd/Relay/API') 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 from the agent. /// /// The name of the file. + /// The starting offset for the transfer. /// The unique identifier for the request. /// The operation context. - Task RequestFileUpload(string filename, Guid id); + Task RequestFileUpload(string filename, long startOffset, Guid id); } /// 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 /// /// The agent from which to retrieve the file. /// The file to retrieve. + /// The starting offset for the transfer. /// A unique ID for the stream. /// An optional timeout value. /// An optional token to monitor for cancellation requests. /// The operation context, including a stream containing the requested file. - Task GetFileStreamAsync(string agentName, string filename, Guid id, int timeout = 3000, CancellationToken cancellationToken = default); + Task GetFileStreamAsync(string agentName, string filename, long startOffset, Guid id, int timeout = 3000, CancellationToken cancellationToken = default); /// /// Handles the client response for a request. @@ -444,11 +445,12 @@ namespace slskd.Relay /// /// The agent from which to retrieve the file. /// The file to retrieve. + /// The starting offset for the transfer. /// A unique ID for the stream. /// An optional timeout value. /// An optional token to monitor for cancellation requests. /// The operation context, including a stream containing the requested file. - public async Task GetFileStreamAsync(string agentName, string filename, Guid id, int timeout = 3000, CancellationToken cancellationToken = default) + public async Task 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)); -- cgit v1.2.3