diff --git a/libtransmission/peer-msgs.cc b/libtransmission/peer-msgs.cc index d15ada5a3..aa5db6615 100644 --- a/libtransmission/peer-msgs.cc +++ b/libtransmission/peer-msgs.cc @@ -619,7 +619,11 @@ private: size_t constexpr Seconds = RequestBufSecs; size_t const estimated_blocks_in_period = (rate_bytes_per_second * Seconds) / tr_block_info::BlockSize; size_t const ceil = reqq ? *reqq : 250; - return std::clamp(estimated_blocks_in_period, Floor, ceil); + + auto max_reqs = estimated_blocks_in_period; + max_reqs = std::min(max_reqs, ceil); + max_reqs = std::max(max_reqs, Floor); + return max_reqs; } void protocolSendRequest(struct peer_request const& req)