aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-08-24 22:13:33 -0500
committerGitHub <noreply@github.com>2026-08-24 22:13:33 -0500
commitbcf4cfb8880703ceb12971117d01eeed09bc85c4 (patch)
tree25e41f60774d9c05bdd3fb06b0e5010d5aaf4900 /src
parentdea5a615c47aa1942d98c735a750d2f395b1a374 (diff)
parent675113541dd548240e9e950bf3faaabdc834a621 (diff)
downloadslskd-bcf4cfb8880703ceb12971117d01eeed09bc85c4.tar.gz
Merge branch 'master' into dependabot/npm_and_yarn/src/web/brace-expansion-1.1.18
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/API/Controllers/ApplicationController.cs3
-rw-r--r--src/slskd/Core/API/Controllers/DebugController.cs73
-rw-r--r--src/slskd/Transfers/Downloads/DownloadService.cs6
3 files changed, 82 insertions, 0 deletions
diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs
index b55fc865..70c260f6 100644
--- a/src/slskd/Core/API/Controllers/ApplicationController.cs
+++ b/src/slskd/Core/API/Controllers/ApplicationController.cs
@@ -148,6 +148,7 @@ namespace slskd.Core.API
/// Forces garbage collection.
/// </summary>
/// <returns></returns>
+ [ApiExplorerSettings(IgnoreApi = true)]
[HttpPost("gc")]
[Authorize(Policy = AuthPolicy.Any)]
public IActionResult CollectGarbage()
@@ -157,6 +158,7 @@ namespace slskd.Core.API
return Ok();
}
+ [ApiExplorerSettings(IgnoreApi = true)]
[HttpGet("dump")]
[Authorize(Policy = AuthPolicy.Any)]
public async Task<IActionResult> DumpMemory()
@@ -167,6 +169,7 @@ namespace slskd.Core.API
return PhysicalFile(file, "application/octet-stream", "slskd.dmp");
}
+ [ApiExplorerSettings(IgnoreApi = true)]
[HttpPost("loopback")]
[Authorize(Policy = AuthPolicy.Any)]
public IActionResult Loopback([FromBody] object body)
diff --git a/src/slskd/Core/API/Controllers/DebugController.cs b/src/slskd/Core/API/Controllers/DebugController.cs
new file mode 100644
index 00000000..b5f6cd33
--- /dev/null
+++ b/src/slskd/Core/API/Controllers/DebugController.cs
@@ -0,0 +1,73 @@
+// <copyright file="DebugController.cs" company="JP Dillingham">
+// ▄▄▄▄ ▄▄▄▄ ▄▄▄▄
+// ▄▄▄▄▄▄█ █▄▄▄▄▄█ █▄▄▄▄▄█ █
+// █__ --█ █__ --█ ◄█ - █
+// █▄▄▄▄▄█▄▄█▄▄▄▄▄█▄▄█▄▄█▄▄▄▄▄█
+// ┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━ ━ ━┉ ┉ ┉
+// │ 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
+// ╰───────────────────────────────────────────╶──── ─ ─── ─ ── ──┈ ┈
+// </copyright>
+
+namespace slskd.Core.API
+{
+ using Asp.Versioning;
+ using Microsoft.AspNetCore.Authorization;
+ using Microsoft.AspNetCore.Mvc;
+ using Soulseek;
+
+ /// <summary>
+ /// Debug.
+ /// </summary>
+ [ApiExplorerSettings(IgnoreApi = true)]
+ [Route("api/v{version:apiVersion}/[controller]")]
+ [ApiVersion("0")]
+ [ApiController]
+ [Produces("application/json")]
+ [Consumes("application/json")]
+ public class DebugController : ControllerBase
+ {
+ public DebugController(ISoulseekClient soulseekClient)
+ {
+ Client = soulseekClient;
+ }
+
+ private ISoulseekClient Client { get; }
+
+ [HttpGet("transfers")]
+ [Authorize(Policy = AuthPolicy.Any)]
+ [ProducesResponseType(typeof(Transfer), 200)]
+ public IActionResult Transfers()
+ {
+ return Ok(new
+ {
+ Soulseek = new
+ {
+ Client.Uploads,
+ Client.Downloads,
+ },
+ });
+ }
+ }
+}
diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs
index a4d48279..30f3c9b1 100644
--- a/src/slskd/Transfers/Downloads/DownloadService.cs
+++ b/src/slskd/Transfers/Downloads/DownloadService.cs
@@ -550,6 +550,12 @@ namespace slskd.Transfers.Downloads
{
Log.Warning("Download of {Filename} from {Username} failed to enqueue remotely after hard time limit of {Duration} seconds. State transition history: {History}", transfer.Filename, username, maxTimeToWaitForEnqueueRequestAck.TotalSeconds, string.Join(", ", transitions));
enqueuedTcs.TrySetException(new TimeoutException($"Download failed to enqueue remotely after hard time limit of {maxTimeToWaitForEnqueueRequestAck.TotalSeconds} secs"));
+
+ // cancel the download attempt so that it doesn't keep running and cause the internal
+ // state of slskd to diverge from the internal state of Soulseek.NET.
+ // the transfer record is recorded as being cancelled when this happens and there's not
+ // an easy/good way to stop it.
+ cts.Cancel();
});
// satisfies conditions #1 and #2