|
|
@ -1024,34 +1024,31 @@ namespace stream |
|
|
|
if (packets.size () > 0) |
|
|
|
if (packets.size () > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_NumResendAttempts++; |
|
|
|
m_NumResendAttempts++; |
|
|
|
if (m_RTO != INITIAL_RTO) |
|
|
|
if (m_NumResendAttempts == 1 && m_RTO != INITIAL_RTO) |
|
|
|
m_RTO *= 2; |
|
|
|
|
|
|
|
switch (m_NumResendAttempts) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
case 1: // congestion avoidance
|
|
|
|
// congestion avoidance
|
|
|
|
|
|
|
|
m_RTO *= 2; |
|
|
|
m_WindowSize -= (m_WindowSize + WINDOW_SIZE_DROP_FRACTION) / WINDOW_SIZE_DROP_FRACTION; // adjustment >= 1
|
|
|
|
m_WindowSize -= (m_WindowSize + WINDOW_SIZE_DROP_FRACTION) / WINDOW_SIZE_DROP_FRACTION; // adjustment >= 1
|
|
|
|
if (m_WindowSize < MIN_WINDOW_SIZE) m_WindowSize = MIN_WINDOW_SIZE; |
|
|
|
if (m_WindowSize < MIN_WINDOW_SIZE) m_WindowSize = MIN_WINDOW_SIZE; |
|
|
|
break; |
|
|
|
} |
|
|
|
case 2: |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
m_TunnelsChangeSequenceNumber = m_SequenceNumber; |
|
|
|
m_TunnelsChangeSequenceNumber = m_SequenceNumber; |
|
|
|
m_RTO = INITIAL_RTO; // drop RTO to initial upon tunnels pair change first time
|
|
|
|
m_RTO = INITIAL_RTO; // drop RTO to initial upon tunnels pair change
|
|
|
|
#if (__cplusplus >= 201703L) // C++ 17 or higher
|
|
|
|
|
|
|
|
[[fallthrough]]; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
// no break here
|
|
|
|
|
|
|
|
case 4: |
|
|
|
|
|
|
|
if (m_RoutingSession) m_RoutingSession->SetSharedRoutingPath (nullptr); |
|
|
|
if (m_RoutingSession) m_RoutingSession->SetSharedRoutingPath (nullptr); |
|
|
|
UpdateCurrentRemoteLease (); // pick another lease
|
|
|
|
if (m_NumResendAttempts & 1) |
|
|
|
LogPrint (eLogWarning, "Streaming: Another remote lease has been selected for stream with rSID=", m_RecvStreamID, ", sSID=", m_SendStreamID); |
|
|
|
{ |
|
|
|
break; |
|
|
|
|
|
|
|
case 3: |
|
|
|
|
|
|
|
// pick another outbound tunnel
|
|
|
|
// pick another outbound tunnel
|
|
|
|
m_TunnelsChangeSequenceNumber = m_SequenceNumber; |
|
|
|
|
|
|
|
if (m_RoutingSession) m_RoutingSession->SetSharedRoutingPath (nullptr); |
|
|
|
|
|
|
|
m_CurrentOutboundTunnel = m_LocalDestination.GetOwner ()->GetTunnelPool ()->GetNextOutboundTunnel (m_CurrentOutboundTunnel); |
|
|
|
m_CurrentOutboundTunnel = m_LocalDestination.GetOwner ()->GetTunnelPool ()->GetNextOutboundTunnel (m_CurrentOutboundTunnel); |
|
|
|
LogPrint (eLogWarning, "Streaming: Another outbound tunnel has been selected for stream with sSID=", m_SendStreamID); |
|
|
|
LogPrint (eLogWarning, "Streaming: Resend #", m_NumResendAttempts, |
|
|
|
break; |
|
|
|
", another outbound tunnel has been selected for stream with sSID=", m_SendStreamID); |
|
|
|
default: ; |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UpdateCurrentRemoteLease (); // pick another lease
|
|
|
|
|
|
|
|
LogPrint (eLogWarning, "Streaming: Resend #", m_NumResendAttempts, |
|
|
|
|
|
|
|
", another remote lease has been selected for stream with rSID=", m_RecvStreamID, ", sSID=", m_SendStreamID); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
SendPackets (packets); |
|
|
|
SendPackets (packets); |
|
|
|
} |
|
|
|
} |
|
|
|