forked from premiere/premiere-libtorrent
fix some warnings in utp_stream
This commit is contained in:
parent
dc7cc3ef37
commit
2edb86c543
|
@ -138,16 +138,7 @@ enum
|
|||
|
||||
// if a packet receives more than this number of
|
||||
// duplicate acks, we'll trigger a fast re-send
|
||||
dup_ack_limit = 3,
|
||||
|
||||
// the max number of packets to fast-resend per
|
||||
// selective ack message
|
||||
// only re-sending a single packet per sack
|
||||
// appears to improve performance by making it
|
||||
// less likely to loose the re-sent packet. Because
|
||||
// when that happens, we must time-out in order
|
||||
// to continue, which takes a long time.
|
||||
sack_resend_limit = 1
|
||||
dup_ack_limit = 3
|
||||
};
|
||||
|
||||
// compare if lhs is less than rhs, taking wrapping
|
||||
|
@ -1605,15 +1596,21 @@ void utp_socket_impl::parse_sack(boost::uint16_t packet_ack, boost::uint8_t cons
|
|||
{
|
||||
experienced_loss(m_fast_resend_seq_nr);
|
||||
int num_resent = 0;
|
||||
while (m_fast_resend_seq_nr != last_ack)
|
||||
|
||||
// only re-sending a single packet per sack
|
||||
// appears to improve performance by making it
|
||||
// less likely to loose the re-sent packet. Because
|
||||
// when that happens, we must time-out in order
|
||||
// to continue, which takes a long time.
|
||||
if (m_fast_resend_seq_nr != last_ack)
|
||||
{
|
||||
packet* p = m_outbuf.at(m_fast_resend_seq_nr);
|
||||
m_fast_resend_seq_nr = (m_fast_resend_seq_nr + 1) & ACK_MASK;
|
||||
if (!p) continue;
|
||||
++num_resent;
|
||||
if (!resend_packet(p, true)) break;
|
||||
m_duplicate_acks = 0;
|
||||
if (num_resent >= sack_resend_limit) break;
|
||||
if (p)
|
||||
{
|
||||
++num_resent;
|
||||
if (resend_packet(p, true)) m_duplicate_acks = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2985,14 +2982,7 @@ bool utp_socket_impl::incoming_packet(boost::uint8_t const* buf, int size
|
|||
return true;
|
||||
}
|
||||
int next_extension = *ptr++;
|
||||
int len = *ptr++;
|
||||
if (len < 0)
|
||||
{
|
||||
UTP_LOGV("%8p: invalid extension length:%d packet:%d\n"
|
||||
, static_cast<void*>(this), len, int(ptr - buf));
|
||||
m_sm->inc_stats_counter(counters::utp_invalid_pkts_in);
|
||||
return true;
|
||||
}
|
||||
int const len = *ptr++;
|
||||
if (ptr - buf + len > ptrdiff_t(size))
|
||||
{
|
||||
UTP_LOG("%8p: ERROR: invalid extension header size:%d packet:%d\n"
|
||||
|
|
Loading…
Reference in New Issue