Interface BoarAcknowledgmentTransport
- All Known Subinterfaces:
BoarBatchedAcknowledgmentTransport
- All Known Implementing Classes:
BatchAcknowledgmentTransport
The send side has three operations: keepalive() for heartbeats,
send(Acknowledgment) to emit a fresh ping with an attached acknowledgment, and
attach(Acknowledgment) to attach an acknowledgment to whatever ping is most recently
in flight (saving bandwidth when one is already pending).
The wire-observed lifecycle goes through onPingSent(long, boolean) and
onPingReceived(long) — these are called by the netty bridge whenever a
NetworkStackLatency packet is observed on the channel.
Implementations decide when the underlying network packet is actually emitted — the
default sends one packet per call; alternatives may batch (e.g. flush every 10ms), coalesce, or
piggyback on a different mechanism the underlying server/proxy provides. They also fully own
acknowledgment dispatch on the receive side, so a custom implementation can use its own queue
structures without involving Boar's default LatencyUtil.
-
Method Summary
Modifier and TypeMethodDescriptionvoidattach(Acknowledgment ack) Bind the acknowledgment to the most recent in-flight ping.voidEmit a keepalive ping with no acknowledgment to dispatch.booleanonPingReceived(long id) Notify the transport that an inbound NetworkStackLatency response was observed on the wire.voidonPingSent(long id, boolean ours) Notify the transport that an outbound NetworkStackLatency packet was observed on the wire.voidsend(Acknowledgment ack) Emit a fresh ping and bind the acknowledgment to it.
-
Method Details
-
keepalive
void keepalive()Emit a keepalive ping with no acknowledgment to dispatch. Used to detect timeouts when no server-state change is pending. -
send
Emit a fresh ping and bind the acknowledgment to it. The acknowledgment's handler runs when the client confirms this ping. -
attach
Bind the acknowledgment to the most recent in-flight ping. If none is pending, dispatch the acknowledgment immediately. -
onPingSent
void onPingSent(long id, boolean ours) Notify the transport that an outbound NetworkStackLatency packet was observed on the wire. Theoursflag is true if the ping originated from Boar (vs. forwarded from upstream). -
onPingReceived
boolean onPingReceived(long id) Notify the transport that an inbound NetworkStackLatency response was observed on the wire. The transport dispatches any associated acknowledgments and updates its own bookkeeping. Returns true to cancel the underlying packet event (i.e. the ping was Boar's own and should not be forwarded upstream).
-