feat: add pedantic subject validation and max payload enforcement on PUB
Move max payload validation from the parser to ProcessPubAsync so the server sends -ERR 'Maximum Payload Violation' and closes the connection (matching Go reference client.go:2442). In pedantic mode, reject PUB with wildcard subjects via -ERR 'Invalid Publish Subject' (client.go:2869). Add disposed guard to SubList.Remove to prevent crash during shutdown.
This commit is contained in:
@@ -15,8 +15,13 @@ public sealed class SubList : IDisposable
|
||||
private readonly TrieLevel _root = new();
|
||||
private Dictionary<string, SubListResult>? _cache = new(StringComparer.Ordinal);
|
||||
private uint _count;
|
||||
private volatile bool _disposed;
|
||||
|
||||
public void Dispose() => _lock.Dispose();
|
||||
public void Dispose()
|
||||
{
|
||||
_disposed = true;
|
||||
_lock.Dispose();
|
||||
}
|
||||
|
||||
public uint Count
|
||||
{
|
||||
@@ -95,6 +100,7 @@ public sealed class SubList : IDisposable
|
||||
|
||||
public void Remove(Subscription sub)
|
||||
{
|
||||
if (_disposed) return;
|
||||
_lock.EnterWriteLock();
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user