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 8564367
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 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 @@ -3844,6 +3843,15 @@ EConnectStatus CUDT::postConnect(const CPacket& response, bool rendezvous, CUDTE

setupCC();

// 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;

// And, I am connected too.
m_bConnecting = false;
m_bConnected = true;
Expand Down

0 comments on commit 8564367

Please sign in to comment.