diff --git a/src/utp_stream.cpp b/src/utp_stream.cpp index 466bfaaa8..18f74fa26 100644 --- a/src/utp_stream.cpp +++ b/src/utp_stream.cpp @@ -2112,7 +2112,7 @@ bool utp_socket_impl::resend_packet(packet* p, bool fast_resend) // since we can't re-packetize, some packets that are // larger than the congestion window must be allowed through // but only if we don't have any outstanding bytes - int window_size_left = std::min(int(m_cwnd >> 16), int(m_adv_wnd)) - m_bytes_in_flight; + int const window_size_left = std::min(int(m_cwnd >> 16), int(m_adv_wnd)) - m_bytes_in_flight; if (!fast_resend && p->size - p->header_size > window_size_left && m_bytes_in_flight > 0) @@ -3344,14 +3344,14 @@ void utp_socket_impl::do_ledbat(const int acked_bytes, const int delay m_sm.inc_stats_counter(counters::utp_samples_below_target); } - std::int64_t linear_gain = (window_factor * delay_factor) >> 16; - linear_gain *= std::int64_t(m_sm.gain_factor()); + std::int64_t const linear_gain = ((window_factor * delay_factor) >> 16) + * std::int64_t(m_sm.gain_factor()); // if the user is not saturating the link (i.e. not filling the // congestion window), don't adjust it at all. if (cwnd_saturated) { - std::int64_t exponential_gain = std::int64_t(acked_bytes) * (1 << 16); + std::int64_t const exponential_gain = std::int64_t(acked_bytes) * (1 << 16); if (m_slow_start) { // mimic TCP slow-start by adding the number of acked @@ -3383,8 +3383,8 @@ void utp_socket_impl::do_ledbat(const int acked_bytes, const int delay } // make sure we don't wrap the cwnd - if (scaled_gain >= (std::numeric_limits::max)() - m_cwnd) - scaled_gain = (std::numeric_limits::max)() - m_cwnd - 1; + if (scaled_gain >= std::numeric_limits::max() - m_cwnd) + scaled_gain = std::numeric_limits::max() - m_cwnd - 1; UTP_LOGV("%8p: do_ledbat delay:%d off_target: %d window_factor:%f target_factor:%f " "scaled_gain:%f cwnd:%d slow_start:%d\n" @@ -3406,7 +3406,7 @@ void utp_socket_impl::do_ledbat(const int acked_bytes, const int delay TORRENT_ASSERT(m_cwnd >= 0); - int window_size_left = std::min(int(m_cwnd >> 16), int(m_adv_wnd)) - in_flight + acked_bytes; + int const window_size_left = std::min(int(m_cwnd >> 16), int(m_adv_wnd)) - in_flight + acked_bytes; if (window_size_left >= m_mtu) { UTP_LOGV("%8p: mtu:%d in_flight:%d adv_wnd:%d cwnd:%d acked_bytes:%d cwnd_full -> 0\n"