Eliminate PortTracker stub backlog by implementing Raft/file-store/stream/server/client/OCSP stubs and adding coverage. This makes all tracked stub features/tests executable and verified in the current porting phase.

This commit is contained in:
Joseph Doherty
2026-02-27 08:56:26 -05:00
parent ba4f41cf71
commit 8849265780
33 changed files with 2938 additions and 407 deletions

View File

@@ -16,6 +16,7 @@
using ZB.MOM.NatsNet.Server.Auth;
using ZB.MOM.NatsNet.Server.Internal;
using ZB.MOM.NatsNet.Server.Internal.DataStructures;
using System.Text;
namespace ZB.MOM.NatsNet.Server;
@@ -1643,7 +1644,50 @@ public sealed class Account : INatsAccount
/// </summary>
internal void UpdateLeafNodes(object sub, int delta)
{
// TODO: session 15 — leaf node subscription propagation.
if (delta == 0 || sub is not Subscription s || s.Subject.Length == 0)
return;
var subject = Encoding.UTF8.GetString(s.Subject);
var queue = s.Queue is { Length: > 0 } ? Encoding.UTF8.GetString(s.Queue) : string.Empty;
_mu.EnterWriteLock();
try
{
_rm ??= new Dictionary<string, int>(StringComparer.Ordinal);
if (!_rm.TryGetValue(subject, out var rc))
rc = 0;
rc += delta;
if (rc <= 0)
_rm.Remove(subject);
else
_rm[subject] = rc;
if (!string.IsNullOrEmpty(queue))
{
_lqws ??= new Dictionary<string, int>(StringComparer.Ordinal);
var key = $"{subject} {queue}";
var qw = s.Qw != 0 ? s.Qw : 1;
if (!_lqws.TryGetValue(key, out var qv))
qv = 0;
qv += delta * qw;
if (qv <= 0)
_lqws.Remove(key);
else
_lqws[key] = qv;
}
}
finally
{
_mu.ExitWriteLock();
}
List<ClientConnection> leafs;
_lmu.EnterReadLock();
try { leafs = [.. _lleafs]; }
finally { _lmu.ExitReadLock(); }
foreach (var leaf in leafs)
leaf.FlushSignal();
}
// -------------------------------------------------------------------------