Skip to content

Commit

Permalink
[core] Refactored checkNAKTimer
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko authored and rndi committed Nov 20, 2019
1 parent 53e179b commit 5aaff2a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9309,18 +9309,16 @@ void CUDT::checkNAKTimer(uint64_t currtime_tk)
*/
const int loss_len = m_pRcvLossList->getLossLength();
SRT_ASSERT(loss_len >= 0);
if (loss_len <= 0)
{
// If there are no losses so far, update the next NACK time,
// so that a loss report is not sent too erly right after a new loss happens.
m_ullNextNAKTime_tk = currtime_tk + m_ullNAKInt_tk;
}
else if (currtime_tk > m_ullNextNAKTime_tk)

if (loss_len > 0)
{
// NAK timer expired, and there is loss to be reported.
if (currtime_tk <= m_ullNextNAKTime_tk)
return; // wait for next NAK time

sendCtrl(UMSG_LOSSREPORT);
m_ullNextNAKTime_tk = currtime_tk + m_ullNAKInt_tk;
}

m_ullNextNAKTime_tk = currtime_tk + m_ullNAKInt_tk;
}

bool CUDT::checkExpTimer(uint64_t currtime_tk)
Expand Down

0 comments on commit 5aaff2a

Please sign in to comment.