Skip to content

Commit

Permalink
[core] Update timers on connection established.
Browse files Browse the repository at this point in the history
CUDT::open sets initial values for timers. However the connection itself is established later. Need to update the timers.
  • Loading branch information
maxsharabayko committed Jul 2, 2019
1 parent 36d0714 commit ed66548
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,13 +1313,12 @@ void CUDT::open()

uint64_t currtime_tk;
CTimer::rdtsc(currtime_tk);
m_ullLastRspTime_tk = currtime_tk;
m_ullNextACKTime_tk = currtime_tk + m_ullSYNInt_tk;
m_ullNextNAKTime_tk = currtime_tk + m_ullNAKInt_tk;
m_ullLastRspTime_tk = currtime_tk;
m_ullNextACKTime_tk = currtime_tk + m_ullSYNInt_tk;
m_ullNextNAKTime_tk = currtime_tk + m_ullNAKInt_tk;
m_ullLastRspAckTime_tk = currtime_tk;
m_ullLastSndTime_tk = currtime_tk;
m_iReXmitCount = 1;
// Fix keepalive
m_ullLastSndTime_tk = currtime_tk;

m_iPktCount = 0;
m_iLightACKCount = 1;
Expand Down Expand Up @@ -4711,6 +4710,16 @@ void CUDT::setupCC()
if ( min_nak_tk )
m_ullMinNakInt_tk = min_nak_tk;

// Update timers
uint64_t currtime_tk;
CTimer::rdtsc(currtime_tk);
m_ullLastRspTime_tk = currtime_tk;
m_ullNextACKTime_tk = currtime_tk + m_ullSYNInt_tk;
m_ullNextNAKTime_tk = currtime_tk + m_ullNAKInt_tk;
m_ullLastRspAckTime_tk = currtime_tk;
m_ullLastSndTime_tk = currtime_tk;


HLOGC(mglog.Debug, log << "setupCC: setting parameters: mss=" << m_iMSS
<< " maxCWNDSize/FlowWindowSize=" << m_iFlowWindowSize
<< " rcvrate=" << m_iDeliveryRate << "p/s (" << m_iByteDeliveryRate << "B/S)"
Expand Down

0 comments on commit ed66548

Please sign in to comment.