mirror of
https://github.com/transmission/transmission.git
synced 2026-04-17 23:54:19 +01:00
fix: handle peer ReqQ smaller than floor (#8713)
(cherry picked from commit 7b92be7a52)
This commit is contained in:
@@ -2156,7 +2156,8 @@ size_t tr_peerMsgsImpl::max_available_reqs() const
|
||||
size_t const estimated_blocks_in_period = (rate.base_quantity() * Seconds) / tr_block_info::BlockSize;
|
||||
auto const ceil = peer_reqq_.value_or(PeerReqQDefault);
|
||||
|
||||
return std::clamp(estimated_blocks_in_period, Floor, ceil);
|
||||
// Don't use std::clamp as `ceil` can be smaller than `Floor`
|
||||
return std::max(Floor, std::min(estimated_blocks_in_period, ceil));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user