feat(batch2): verify parser remainder features

This commit is contained in:
Joseph Doherty
2026-02-28 07:06:09 -05:00
parent f17d6c6bfb
commit 3ace39d606
3 changed files with 159 additions and 1 deletions

View File

@@ -1158,6 +1158,58 @@ public sealed partial class ClientConnection
TraceInOp("PRE", pre);
}
// =========================================================================
// Parser compatibility wrappers (features 2588, 2590, 2591)
// =========================================================================
/// <summary>
/// Parses protocol bytes using the shared parser state for this connection.
/// Mirrors Go <c>client.parse</c>.
/// </summary>
internal Exception? Parse(byte[] buf, IProtocolHandler handler)
{
ArgumentNullException.ThrowIfNull(buf);
ArgumentNullException.ThrowIfNull(handler);
ParseCtx.Kind = Kind;
ParseCtx.HasHeaders = Headers;
if (_mcl > 0)
ParseCtx.MaxControlLine = _mcl;
if (_mpay != 0)
ParseCtx.MaxPayload = _mpay;
return ProtocolParser.Parse(ParseCtx, handler, buf);
}
/// <summary>
/// Checks max control line enforcement for the current connection kind.
/// Mirrors Go <c>client.overMaxControlLineLimit</c>.
/// </summary>
internal Exception? OverMaxControlLineLimit(byte[] arg, int mcl, IProtocolHandler handler)
{
ArgumentNullException.ThrowIfNull(arg);
ArgumentNullException.ThrowIfNull(handler);
ParseCtx.Kind = Kind;
return ProtocolParser.OverMaxControlLineLimit(ParseCtx, handler, arg, mcl);
}
/// <summary>
/// Re-processes stored pub args for split-buffer message payload handling.
/// Mirrors Go <c>client.clonePubArg</c>.
/// </summary>
internal Exception? ClonePubArg(IProtocolHandler handler, bool lmsg)
{
ArgumentNullException.ThrowIfNull(handler);
ParseCtx.Kind = Kind;
ParseCtx.HasHeaders = Headers;
if (_mpay != 0)
ParseCtx.MaxPayload = _mpay;
return ProtocolParser.ClonePubArg(ParseCtx, handler, lmsg);
}
/// <summary>
/// Generates the INFO JSON bytes sent to the client on connect.
/// Stub — full implementation in session 09.