|
|
@ -434,7 +434,7 @@ namespace transport |
|
|
|
return ackBlockSent; |
|
|
|
return ackBlockSent; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SSU2Session::Resend (uint64_t ts) |
|
|
|
size_t SSU2Session::Resend (uint64_t ts) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// resend handshake packet
|
|
|
|
// resend handshake packet
|
|
|
|
if (m_SentHandshakePacket && ts >= m_SentHandshakePacket->sendTime + SSU2_HANDSHAKE_RESEND_INTERVAL) |
|
|
|
if (m_SentHandshakePacket && ts >= m_SentHandshakePacket->sendTime + SSU2_HANDSHAKE_RESEND_INTERVAL) |
|
|
@ -442,10 +442,10 @@ namespace transport |
|
|
|
LogPrint (eLogDebug, "SSU2: Resending ", (int)m_State); |
|
|
|
LogPrint (eLogDebug, "SSU2: Resending ", (int)m_State); |
|
|
|
ResendHandshakePacket (); |
|
|
|
ResendHandshakePacket (); |
|
|
|
m_SentHandshakePacket->sendTime = ts; |
|
|
|
m_SentHandshakePacket->sendTime = ts; |
|
|
|
return; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
// resend data packets
|
|
|
|
// resend data packets
|
|
|
|
if (m_SentPackets.empty ()) return; |
|
|
|
if (m_SentPackets.empty ()) return 0; |
|
|
|
std::map<uint32_t, std::shared_ptr<SSU2SentPacket> > resentPackets; |
|
|
|
std::map<uint32_t, std::shared_ptr<SSU2SentPacket> > resentPackets; |
|
|
|
for (auto it = m_SentPackets.begin (); it != m_SentPackets.end (); ) |
|
|
|
for (auto it = m_SentPackets.begin (); it != m_SentPackets.end (); ) |
|
|
|
if (ts >= it->second->sendTime + it->second->numResends*m_RTO) |
|
|
|
if (ts >= it->second->sendTime + it->second->numResends*m_RTO) |
|
|
@ -456,7 +456,7 @@ namespace transport |
|
|
|
m_SentPackets.clear (); |
|
|
|
m_SentPackets.clear (); |
|
|
|
m_SendQueue.clear (); |
|
|
|
m_SendQueue.clear (); |
|
|
|
RequestTermination (eSSU2TerminationReasonTimeout); |
|
|
|
RequestTermination (eSSU2TerminationReasonTimeout); |
|
|
|
return; |
|
|
|
return resentPackets.size (); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
@ -478,7 +478,9 @@ namespace transport |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
m_WindowSize >>= 1; // /2
|
|
|
|
m_WindowSize >>= 1; // /2
|
|
|
|
if (m_WindowSize < SSU2_MIN_WINDOW_SIZE) m_WindowSize = SSU2_MIN_WINDOW_SIZE; |
|
|
|
if (m_WindowSize < SSU2_MIN_WINDOW_SIZE) m_WindowSize = SSU2_MIN_WINDOW_SIZE; |
|
|
|
|
|
|
|
return resentPackets.size (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SSU2Session::ResendHandshakePacket () |
|
|
|
void SSU2Session::ResendHandshakePacket () |
|
|
|