Package io.aeron.driver
Class RetransmitHandler
java.lang.Object
io.aeron.driver.RetransmitHandler
Tracking and handling of retransmit request, NAKs, for senders, and receivers.
When configured for multicast, a max number of retransmits is permitted by
Configuration.MAX_RESEND_DEFAULT. Additional received NAKs will be ignored if this maximum is reached.
When configured for unicast, a single outstanding retransmit is permitted, and additional received NAKs
will be ignored iff they overlap the current retransmit - otherwise the previous retransmit is assumed to have
'worked' and the new NAK will take its place.
-
Constructor Summary
ConstructorsConstructorDescriptionRetransmitHandler(NanoClock nanoClock, AtomicCounter invalidPackets, FeedbackDelayGenerator delayGenerator, FeedbackDelayGenerator lingerTimeoutGenerator, boolean hasGroupSemantics, int maxRetransmits, AtomicCounter retransmitOverflowCounter) Create a handler for the dealing with the reception of frame request a frame to be retransmitted. -
Method Summary
Modifier and TypeMethodDescriptionvoidonNak(int termId, int termOffset, int length, int termLength, int mtuLength, FlowControl flowControl, RetransmitSender retransmitSender) Called on reception of a NAK to start retransmit handling.voidonRetransmitReceived(int termId, int termOffset) Called to indicate a retransmission is received that may obviate the need to send one ourselves.voidprocessTimeouts(long nowNs, RetransmitSender retransmitSender) Called to process any outstanding timeouts.
-
Constructor Details
-
RetransmitHandler
public RetransmitHandler(NanoClock nanoClock, AtomicCounter invalidPackets, FeedbackDelayGenerator delayGenerator, FeedbackDelayGenerator lingerTimeoutGenerator, boolean hasGroupSemantics, int maxRetransmits, AtomicCounter retransmitOverflowCounter) Create a handler for the dealing with the reception of frame request a frame to be retransmitted.- Parameters:
nanoClock- used to determine time.invalidPackets- for recording invalid packets.delayGenerator- to use for delay determination.lingerTimeoutGenerator- to use for linger timeout.hasGroupSemantics- indicates multicast/MDC semantics.maxRetransmits- max retransmits for when group semantics is enabledretransmitOverflowCounter- counter to track overflows.
-
-
Method Details
-
onNak
public void onNak(int termId, int termOffset, int length, int termLength, int mtuLength, FlowControl flowControl, RetransmitSender retransmitSender) Called on reception of a NAK to start retransmit handling.- Parameters:
termId- from the NAK and the term id of the buffer to retransmit from.termOffset- from the NAK and the offset of the data to retransmit.length- of the missing data.termLength- of the term buffer.mtuLength- for the publication.flowControl- for the publication (to clamp the retransmission length).retransmitSender- to call if an immediate retransmit is required.
-
onRetransmitReceived
public void onRetransmitReceived(int termId, int termOffset) Called to indicate a retransmission is received that may obviate the need to send one ourselves.NOTE: Currently only called from unit tests. Would be used for retransmitting from receivers for NAK suppression.
- Parameters:
termId- of the data.termOffset- of the data.
-
processTimeouts
Called to process any outstanding timeouts.- Parameters:
nowNs- time in nanoseconds.retransmitSender- to call on retransmissions.
-