| 12087 | } |
| 12088 | |
| 12089 | void srt::CUDT::checkRexmitTimer(const steady_clock::time_point& currtime) |
| 12090 | { |
| 12091 | // Check if HSv4 should be retransmitted, and if KM_REQ should be resent if the side is INITIATOR. |
| 12092 | checkSndTimers(); |
| 12093 | |
| 12094 | // There are two algorithms of blind packet retransmission: LATEREXMIT and FASTREXMIT. |
| 12095 | // |
| 12096 | // LATEREXMIT is only used with FileCC. |
| 12097 | // The RTO is triggered when some time has passed since the last ACK from |
| 12098 | // the receiver, while there is still some unacknowledged data in the sender's buffer, |
| 12099 | // and the loss list is empty at the moment of RTO (nothing to retransmit yet). |
| 12100 | // |
| 12101 | // FASTREXMIT is only used with LiveCC. |
| 12102 | // The RTO is triggered if the receiver is not configured to send periodic NAK reports, |
| 12103 | // when some time has passed since the last ACK from the receiver, |
| 12104 | // while there is still some unacknowledged data in the sender's buffer. |
| 12105 | // |
| 12106 | // In case the above conditions are met, the unacknowledged packets |
| 12107 | // in the sender's buffer will be added to the SND loss list and retransmitted. |
| 12108 | // |
| 12109 | |
| 12110 | { |
| 12111 | ScopedLock ack_lock(m_RecvAckLock); |
| 12112 | const uint64_t rtt_syn = (m_iSRTT + 4 * m_iRTTVar + 2 * COMM_SYN_INTERVAL_US); |
| 12113 | const uint64_t exp_int_us = (m_iReXmitCount * rtt_syn + COMM_SYN_INTERVAL_US); |
| 12114 | |
| 12115 | if (currtime <= (m_tsLastRspAckTime + microseconds_from(exp_int_us))) |
| 12116 | return; |
| 12117 | } |
| 12118 | |
| 12119 | // If there is no unacknowledged data in the sending buffer, |
| 12120 | // then there is nothing to retransmit. |
| 12121 | if (m_pSndBuffer->getCurrBufSize() <= 0) |
| 12122 | return; |
| 12123 | |
| 12124 | const bool is_laterexmit = m_CongCtl->rexmitMethod() == SrtCongestion::SRM_LATEREXMIT; // FileCC |
| 12125 | const bool is_fastrexmit = m_CongCtl->rexmitMethod() == SrtCongestion::SRM_FASTREXMIT; // LiveCC |
| 12126 | |
| 12127 | // If the receiver will send periodic NAK reports, then FASTREXMIT (live) is inactive. |
| 12128 | // TODO: Probably some method of "blind rexmit" MUST BE DONE, when TLPKTDROP is off. |
| 12129 | if (is_fastrexmit && m_bPeerNakReport) |
| 12130 | return; |
| 12131 | |
| 12132 | // Schedule a retransmission IF: |
| 12133 | // - there are packets in flight (getFlightSpan() > 0); |
| 12134 | // - in case of LATEREXMIT (File Mode): the sender loss list is empty |
| 12135 | // (the receiver didn't send any LOSSREPORT, or LOSSREPORT was lost on track). |
| 12136 | // - in case of FASTREXMIT (Live Mode): the RTO (rtt_syn) was triggered, therefore |
| 12137 | // schedule unacknowledged packets for retransmission regardless of the loss list emptiness. |
| 12138 | if (getFlightSpan() > 0 && (!is_laterexmit || m_pSndLossList->getLossLength() == 0)) |
| 12139 | { |
| 12140 | // Sender: Insert all the packets sent after last received acknowledgement into the sender loss list. |
| 12141 | ScopedLock acklock(m_RecvAckLock); // Protect packet retransmission |
| 12142 | // Resend all unacknowledged packets on timeout, but only if there is no packet in the loss list |
| 12143 | const int32_t csn = m_iSndCurrSeqNo; |
| 12144 | const int num = m_pSndLossList->insert(m_iSndLastAck, csn); |
| 12145 | if (num > 0) |
| 12146 | { |
nothing calls this directly
no test coverage detected