fix: handle peer ReqQ smaller than floor (#8713)

(cherry picked from commit 7b92be7a52)
This commit is contained in:
Yat Ho
2026-03-23 22:11:07 +08:00
committed by GitHub
parent 79c7e70958
commit cfaeb85ea4

View File

@@ -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