feat(batch45): implement events server methods — stats, remote tracking, connection events
Port 80 features from server/events.go including the full events infrastructure: internal send/receive loops, system subscription machinery, statsz heartbeats, remote server tracking, connection event advisories, user-info handler, OCSP peer reject events, remote latency merge, kick/ldm client, and helper functions. Add ClearConnectionHeartbeatTimer/SetConnectionHeartbeatTimer to Account, add MsgHandler/SysMsgHandler delegates and supporting types (ServerApiResponse, EventFilterOptions, StatszEventOptions, UserInfo, KickClientReq, LdmClientReq, AccNumSubsReq) to EventTypes.cs, and add Seq field to ServerInfo for heartbeat sequence tracking.
This commit is contained in:
@@ -4507,6 +4507,28 @@ public sealed partial class Account : INatsAccount
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears the connection-heartbeat timer. Caller must hold the account lock.
|
||||
/// Mirrors Go <c>(a *Account) clearConnectionTimer()</c> in server/events.go.
|
||||
/// </summary>
|
||||
internal void ClearConnectionHeartbeatTimer()
|
||||
{
|
||||
ClearTimerLocked(ref _ctmr);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts or resets the connection-heartbeat timer.
|
||||
/// Caller must hold the account lock.
|
||||
/// Mirrors Go inline timer setup in <c>sendAccConnsUpdate()</c>.
|
||||
/// </summary>
|
||||
internal void SetConnectionHeartbeatTimer(long delayMs, Action callback)
|
||||
{
|
||||
if (_ctmr == null)
|
||||
_ctmr = new Timer(_ => callback(), null, delayMs, Timeout.Infinite);
|
||||
else
|
||||
_ctmr.Change(delayMs, Timeout.Infinite);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops and nulls out a timer. Lock must be held by the caller.
|
||||
/// Mirrors Go <c>clearTimer(t **time.Timer)</c>.
|
||||
|
||||
Reference in New Issue
Block a user