aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/Blacklist.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/slskd/Core/Blacklist.cs b/src/slskd/Core/Blacklist.cs
index 4a47b8a8..7b1a46c6 100644
--- a/src/slskd/Core/Blacklist.cs
+++ b/src/slskd/Core/Blacklist.cs
@@ -268,13 +268,17 @@ public class Blacklist
}
// copy working dictionary to a temporary cache to:
- // * convert List<> to array to increase access speed
+ // * deduplicate entries
// * sort arrays by first IP to enable binary search (future?)
+ // * convert List<> to array to increase access speed
var tempCache = new ConcurrentDictionary<int, (uint First, uint Last)[]>();
foreach (var key in dict.Keys)
{
- tempCache[key] = dict[key].OrderBy(x => x.First).ToArray();
+ tempCache[key] = dict[key]
+ .Distinct()
+ .OrderBy(x => x.First)
+ .ToArray();
}
// swap the temporary cache for the "real" cache, enabling a bumpless update