| 11991 | } |
| 11992 | |
| 11993 | bool srt::CUDT::checkExpTimer(const steady_clock::time_point& currtime, int check_reason SRT_ATR_UNUSED) |
| 11994 | { |
| 11995 | // VERY HEAVY LOGGING |
| 11996 | #if ENABLE_HEAVY_LOGGING & 1 |
| 11997 | static const char* const decisions [] = { |
| 11998 | "ACK", |
| 11999 | "LITE-ACK", |
| 12000 | "NAKREPORT" |
| 12001 | }; |
| 12002 | |
| 12003 | string decision = "NOTHING"; |
| 12004 | if (check_reason) |
| 12005 | { |
| 12006 | ostringstream decd; |
| 12007 | decision = ""; |
| 12008 | for (int i = 0; i < LAST_BECAUSE_BIT; ++i) |
| 12009 | { |
| 12010 | int flag = 1 << i; |
| 12011 | if (check_reason & flag) |
| 12012 | decd << decisions[i] << " "; |
| 12013 | } |
| 12014 | decision = decd.str(); |
| 12015 | } |
| 12016 | HLOGC(xtlog.Debug, log << CONID() << "checkTimer: ACTIVITIES PERFORMED: " << decision); |
| 12017 | #endif |
| 12018 | |
| 12019 | // In UDT the m_bUserDefinedRTO and m_iRTO were in CCC class. |
| 12020 | // There's nothing in the original code that alters these values. |
| 12021 | |
| 12022 | steady_clock::time_point next_exp_time; |
| 12023 | if (m_CongCtl->RTO()) |
| 12024 | { |
| 12025 | next_exp_time = m_tsLastRspTime.load() + microseconds_from(m_CongCtl->RTO()); |
| 12026 | } |
| 12027 | else |
| 12028 | { |
| 12029 | steady_clock::duration exp_timeout = |
| 12030 | microseconds_from(m_iEXPCount * (m_iSRTT + 4 * m_iRTTVar) + COMM_SYN_INTERVAL_US); |
| 12031 | if (exp_timeout < (m_iEXPCount * m_tdMinExpInterval)) |
| 12032 | exp_timeout = m_iEXPCount * m_tdMinExpInterval; |
| 12033 | next_exp_time = m_tsLastRspTime.load() + exp_timeout; |
| 12034 | } |
| 12035 | |
| 12036 | if (currtime <= next_exp_time && !m_bBreakAsUnstable) |
| 12037 | return false; |
| 12038 | |
| 12039 | // ms -> us |
| 12040 | const int PEER_IDLE_TMO_US = m_config.iPeerIdleTimeout_ms * 1000; |
| 12041 | // Haven't received any information from the peer, is it dead?! |
| 12042 | // timeout: at least 16 expirations and must be greater than 5 seconds |
| 12043 | time_point last_rsp_time = m_tsLastRspTime.load(); |
| 12044 | if (m_bBreakAsUnstable || ((m_iEXPCount > COMM_RESPONSE_MAX_EXP) && |
| 12045 | (currtime - last_rsp_time > microseconds_from(PEER_IDLE_TMO_US)))) |
| 12046 | { |
| 12047 | // |
| 12048 | // Connection is broken. |
| 12049 | // UDT does not signal any information about this instead of to stop quietly. |
| 12050 | // Application will detect this when it calls any UDT methods next time. |
nothing calls this directly
no test coverage detected