From c6f3bcb5da8d9a075789b1136cf46bb1ad86835d Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 22 Apr 2026 18:48:42 -0500 Subject: use only cached blacklist status pre-search --- src/slskd/Application.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/slskd/Application.cs') diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index a8a7883a..b25713ef 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -1651,7 +1651,9 @@ namespace slskd var sw = new Stopwatch(); sw.Start(); - if (Users.IsBlacklisted(username)) + // opportunistically try and avoid performing the search if we have a cached blacklisted value, otherwise + // hold off on computing it and filling the cache until we have the user's IP + if (Users.IsBlacklisted(username, bypassCache: false)) { return null; } -- cgit v1.2.3 From b7e5f00ce9a9d5f44b956e4f1a70f84fc1b2bea8 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 22 Apr 2026 18:48:56 -0500 Subject: add obsolete flag to BlacklistedGroup --- src/slskd/Application.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/slskd/Application.cs') diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index b25713ef..6112198c 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -94,6 +94,7 @@ namespace slskd /// /// The name of the blacklisted user group. /// + [Obsolete("use IsBlacklisted instead")] public const string BlacklistedGroup = "blacklisted"; private static readonly string ApplicationShutdownTransferExceptionMessage = "Application shut down"; -- cgit v1.2.3 From 1b420744ef3942785de2a1bc72a0ff2e8734b5d2 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 23 Apr 2026 18:02:04 -0500 Subject: don't send place in queue to blacklisted users --- src/slskd/Application.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/slskd/Application.cs') diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 6112198c..814e01a3 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -1381,6 +1381,12 @@ namespace slskd private Task PlaceInQueueResolver(string username, IPEndPoint endpoint, string filename) { + if (Users.IsBlacklisted(username, endpoint.Address)) + { + Log.Information("Returned empty directory listing for blacklisted user {Username} ({IP})", username, endpoint.Address); + return Task.FromResult(null); + } + try { var place = Transfers.Uploads.Queue.EstimatePosition(username, filename); -- cgit v1.2.3