Increase m_in_buf_size and max_packet_reorder to better handle links with high latency

This commit is contained in:
V.G. Bulavintsev 2018-03-01 10:41:29 +01:00 committed by Arvid Norberg
parent bf2f0a9c55
commit 257f625e2e
1 changed files with 4 additions and 2 deletions

View File

@ -136,8 +136,6 @@ enum
{
ACK_MASK = 0xffff,
// the number of packets that'll fit in the reorder buffer
max_packets_reorder = 512,
// if a packet receives more than this number of
// duplicate acks, we'll trigger a fast re-send
@ -2862,6 +2860,10 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
if (ph->get_type() == ST_DATA)
m_sm->inc_stats_counter(counters::utp_payload_pkts_in);
// the number of packets that'll fit in the reorder buffer
// incoming MTU of 1100 and minimal size of 16 packets are chosen arbitrarly
const boost::uint32_t max_packets_reorder = std::max(16, m_in_buf_size / 1100);
if (m_state != UTP_STATE_NONE
&& m_state != UTP_STATE_SYN_SENT
&& compare_less_wrap((m_ack_nr + max_packets_reorder) & ACK_MASK, ph->seq_nr, ACK_MASK))