Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix triggering loss for uTP packets that were never sent #7107

Merged
merged 1 commit into from
Sep 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/utp_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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;
}
Expand Down