refactor(bans): drop BanChannel.Configure, which only re-ran a swept Configure
BanConfiguration.Configure() is a static Configure() on a static class, so the AssemblyHandler sweep already reaches it. BanChannel.Configure() did nothing but call it -- and was itself swept AND called explicitly from NetState.Configure(), so the same load was reached three ways. Nothing reads BanConfiguration.Settings during the Configure phase (only the accept path does, long after the sweep), so there was no ordering guarantee to preserve here. Removed the method and the explicit call. The equivalent-looking calls in BlocklistFilter.Configure() and CrowdSecReporter.Configure() are NOT the same thing and stay: those are instance methods the sweep never sees, invoked from Register(), and each reads its settings immediately -- so calling their configuration loader first is a real ordering guarantee, made free by the same idempotency guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
cb2a33113a
commit
f3b7c7451c
3 changed files with 2 additions and 14 deletions
|
|
@ -34,14 +34,6 @@ public static class BanChannel
|
|||
|
||||
public static IReadOnlyList<IBanReporter> Reporters => _reporters;
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
// Load ban policy for the accept path. Reporters are NOT built here — content registers them
|
||||
// via Register() during the same Configure() sweep, in any order relative to this call, so we
|
||||
// must not clobber any registrations that may already have arrived.
|
||||
BanConfiguration.Configure();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers a contribution sink from content (inversion of control). Idempotent by
|
||||
/// <see cref="IBanReporter.Name"/>: a second registration of the same name is ignored. Configures the
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ public static class BanConfiguration
|
|||
|
||||
public static void Configure()
|
||||
{
|
||||
// Idempotent: this Configure() is auto-discovered and also called explicitly by BanChannel,
|
||||
// so guard against a redundant second load.
|
||||
// Reached by the Configure sweep, which is the only caller. Idempotent anyway, so a second call
|
||||
// cannot re-deserialize or re-write the template over an operator's edits.
|
||||
if (Settings != null)
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -96,10 +96,6 @@ public partial class NetState : IComparable<NetState>, IValueLinkListNode<NetSta
|
|||
|
||||
// Initialize IORingGroup and buffer pools
|
||||
ConfigureNetwork();
|
||||
|
||||
// Load ban policy. Reporters (content) register themselves during the same Configure sweep, as do
|
||||
// the accept-path IConnectionFilters.
|
||||
Bans.BanChannel.Configure();
|
||||
}
|
||||
|
||||
// Internal constructor for accepted sockets
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue