| 3594 | } |
| 3595 | |
| 3596 | void srt::CUDT::synchronizeWithGroup(CUDTGroup* gp) |
| 3597 | { |
| 3598 | ScopedLock gl (*gp->exp_groupLock()); |
| 3599 | |
| 3600 | // We have blocked here the process of connecting a new |
| 3601 | // socket and adding anything new to the group, so no such |
| 3602 | // thing may happen in the meantime. |
| 3603 | steady_clock::time_point start_time, peer_start_time; |
| 3604 | |
| 3605 | start_time = m_stats.tsStartTime; |
| 3606 | peer_start_time = m_tsRcvPeerStartTime; |
| 3607 | |
| 3608 | if (!gp->applyGroupTime((start_time), (peer_start_time))) |
| 3609 | { |
| 3610 | HLOGC(gmlog.Debug, |
| 3611 | log << CONID() << "synchronizeWithGroup: ST=" << FormatTime(m_stats.tsStartTime) << " -> " |
| 3612 | << FormatTime(start_time) << " PST=" << FormatTime(m_tsRcvPeerStartTime) << " -> " |
| 3613 | << FormatTime(peer_start_time)); |
| 3614 | m_stats.tsStartTime = start_time; |
| 3615 | m_tsRcvPeerStartTime = peer_start_time; |
| 3616 | } |
| 3617 | else |
| 3618 | { |
| 3619 | // This was the first connected socket and it defined start time. |
| 3620 | HLOGC(gmlog.Debug, |
| 3621 | log << CONID() << "synchronizeWithGroup: ST=" << FormatTime(m_stats.tsStartTime) |
| 3622 | << " PST=" << FormatTime(m_tsRcvPeerStartTime)); |
| 3623 | } |
| 3624 | |
| 3625 | steady_clock::time_point rcv_buffer_time_base; |
| 3626 | bool rcv_buffer_wrap_period = false; |
| 3627 | steady_clock::duration rcv_buffer_udrift(0); |
| 3628 | if (m_bTsbPd && gp->getBufferTimeBase(this, (rcv_buffer_time_base), (rcv_buffer_wrap_period), (rcv_buffer_udrift))) |
| 3629 | { |
| 3630 | // We have at least one socket in the group, each socket should have |
| 3631 | // the value of the timebase set exactly THE SAME. |
| 3632 | |
| 3633 | // In case when we have the following situation: |
| 3634 | |
| 3635 | // - the existing link is before [LAST30] (so wrap period is off) |
| 3636 | // - the new link gets the timestamp from [LAST30] range |
| 3637 | // --> this will be recognized as entering the wrap period, next |
| 3638 | // timebase will get added a segment to this value |
| 3639 | // |
| 3640 | // The only dangerous situations could be when one link gets |
| 3641 | // timestamps from the [FOLLOWING30] and the other in [FIRST30], |
| 3642 | // but between them there's a 30s distance, considered large enough |
| 3643 | // time to not fill a network window. |
| 3644 | enterCS(m_RecvLock); |
| 3645 | m_pRcvBuffer->applyGroupTime(rcv_buffer_time_base, rcv_buffer_wrap_period, m_iTsbPdDelay_ms * 1000, rcv_buffer_udrift); |
| 3646 | m_pRcvBuffer->setPeerRexmitFlag(m_bPeerRexmitFlag); |
| 3647 | leaveCS(m_RecvLock); |
| 3648 | |
| 3649 | HLOGC(gmlog.Debug, log << "AFTER HS: Set Rcv TsbPd mode: delay=" |
| 3650 | << (m_iTsbPdDelay_ms/1000) << "." << (m_iTsbPdDelay_ms%1000) |
| 3651 | << "s GROUP TIME BASE: " << FormatTime(rcv_buffer_time_base) |
| 3652 | << " (" << (rcv_buffer_wrap_period ? "" : "NOT") << " WRAP PERIOD)"); |
| 3653 | } |
nothing calls this directly
no test coverage detected