SIGN IN SIGN UP

Reset-on-message ping/close timers for AHP liveness (#316722)

* Replace ping interval with reset-on-message ping/close timers

Per @connor4312's review on #316358: rather than polling on a 5s
interval and comparing timestamps, arm two TimeoutTimers and reset
them on every received message. The ping timer fires after PING_INTERVAL
of silence and sends a single ping; the close timer fires after
PING_INTERVAL + LIVENESS_TIMEOUT of continued silence and force-closes
the transport. Busy connections generate no ping traffic at all, and
the LoadEstimator suppression now lives in a single place.

(Written by Copilot)

* Address Copilot review: dispose dead transport, re-arm close timer at PING_INTERVAL on high load

- _onCloseTimer now disposes the transport listeners (and thus the
  underlying transport) before routing into the soft-reconnect or
  hard-close path. This prevents a half-open WebSocket from leaking on
  the non-factory path and stops the dead transport from delivering
  late messages to a Reconnecting/Closed client.

- High-load suppression now re-arms only the close timer, at
  PING_INTERVAL_MS rather than PING_INTERVAL_MS + LIVENESS_TIMEOUT_MS,
  so liveness re-evaluation happens promptly once load normalizes
  (matching PersistentProtocol's keepalive cadence).

(Written by Copilot)
R
Rob Lourens committed
1e1f6fbd32e59d04b50e89da04dcc637e0560519
Parent: 33ee614
Committed by GitHub <noreply@github.com> on 5/16/2026, 9:19:06 PM