mirror of
https://github.com/transmission/transmission
synced 2024-12-29 19:16:23 +00:00
fix: std::clamp() assertion failure in maxAvailableReqs() (#5203)
This commit is contained in:
parent
900281eb1c
commit
dabd29f2b2
1 changed files with 5 additions and 1 deletions
|
@ -619,7 +619,11 @@ private:
|
||||||
size_t constexpr Seconds = RequestBufSecs;
|
size_t constexpr Seconds = RequestBufSecs;
|
||||||
size_t const estimated_blocks_in_period = (rate_bytes_per_second * Seconds) / tr_block_info::BlockSize;
|
size_t const estimated_blocks_in_period = (rate_bytes_per_second * Seconds) / tr_block_info::BlockSize;
|
||||||
size_t const ceil = reqq ? *reqq : 250;
|
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)
|
void protocolSendRequest(struct peer_request const& req)
|
||||||
|
|
Loading…
Reference in a new issue