diff --git a/ChangeLog b/ChangeLog index 4a581df2ab1..e8e779eb1cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * uTP performance, fix packet loss when sending is stalled * fix trackers being stuck after session pause/resume * fix bug in hash_picker with empty files * uTP performance, prevent premature timeouts/resends diff --git a/src/utp_stream.cpp b/src/utp_stream.cpp index 0719d5bc45e..7b66396b403 100644 --- a/src/utp_stream.cpp +++ b/src/utp_stream.cpp @@ -933,6 +933,8 @@ void utp_socket_impl::send_syn() if (!m_stalled) ++p->num_transmissions; + else + p->need_resend = true; TORRENT_ASSERT(!m_outbuf.at(m_seq_nr)); TORRENT_ASSERT(h->seq_nr == m_seq_nr); @@ -1711,6 +1713,10 @@ bool utp_socket_impl::send_pkt(int const flags) TORRENT_ASSERT(p->mtu_probe == (m_seq_nr == m_mtu_seq) || m_seq_nr == 0); + // If we're stalled we'll need to resend + if (m_stalled) + p->need_resend = true; + // If this packet is undersized then note the sequenece number so we // never have more than one undersized packet in flight at once if (int(p->size) < std::min(int(p->allocated), effective_mtu)) @@ -1878,6 +1884,8 @@ bool utp_socket_impl::resend_packet(packet* p, bool fast_resend) if (!m_stalled) ++p->num_transmissions; + else + p->need_resend = true; return !m_stalled; }