21 lines
751 B
C#
21 lines
751 B
C#
namespace SVSim.BattleNode.Reliability;
|
|
|
|
/// <summary>
|
|
/// Per-session inbound-emit ledger. Dedupes the client's pubSeq so we never dispatch
|
|
/// a retransmitted emit twice; ack-echo (via SIO callback) is the caller's job.
|
|
/// </summary>
|
|
public sealed class InboundTracker
|
|
{
|
|
private readonly HashSet<long> _seen = new();
|
|
|
|
/// <summary>Highest pubSeq observed so far. Reported via Gungnir for diagnostics.</summary>
|
|
public long HighWaterMark { get; private set; }
|
|
|
|
/// <summary>Record an incoming pubSeq. Returns true if the caller should dispatch the envelope, false on duplicate.</summary>
|
|
public bool Observe(long pubSeq)
|
|
{
|
|
if (pubSeq > HighWaterMark) HighWaterMark = pubSeq;
|
|
return _seen.Add(pubSeq);
|
|
}
|
|
}
|