make uTP less aggressive resetting cwnd when idle

This commit is contained in:
Arvid Norberg 2012-06-16 02:16:45 +00:00
parent af7c890c64
commit 1b2805118d
2 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,5 @@
* make uTP less aggressive resetting cwnd when idle
0.16.1 release 0.16.1 release
* fixed crash when providing corrupt resume data * fixed crash when providing corrupt resume data

View File

@ -2880,7 +2880,19 @@ void utp_socket_impl::tick(ptime const& now)
// we can now sent messages again, the send window was opened // we can now sent messages again, the send window was opened
if ((m_cwnd >> 16) < m_mtu) window_opened = true; if ((m_cwnd >> 16) < m_mtu) window_opened = true;
m_cwnd = boost::int64_t(m_mtu) << 16; if (m_bytes_in_flight == 0 && (m_cwnd >> 16) >= m_mtu)
{
// this is just a timeout because this direction of
// the stream is idle. Don't reset the cwnd, just decay it
m_cwnd = m_cwnd * 2 / 3;
}
else
{
// we timed out because a packet was not ACKed or because
// the cwnd was made smaller than one packet
m_cwnd = boost::int64_t(m_mtu) << 16;
}
if (m_outbuf.size()) ++m_num_timeouts; if (m_outbuf.size()) ++m_num_timeouts;
if (m_num_timeouts > m_sm->num_resends()) if (m_num_timeouts > m_sm->num_resends())