mirror of
https://github.com/monero-project/monero.git
synced 2024-12-26 19:49:24 -05:00
Fix time comparison math
Dividing `dt` here by 1e6 converts it to seconds, but that is clearly wrong since `REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY` is measured in microseconds. As a result, this if statement was effectively never used.
This commit is contained in:
parent
411f1b0ee3
commit
72ca7e3b0f
@ -1673,9 +1673,9 @@ skip:
|
||||
const float max_multiplier = 10.f;
|
||||
const float min_multiplier = 1.25f;
|
||||
float multiplier = max_multiplier;
|
||||
if (dt/1e6 >= REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY)
|
||||
if (dt >= REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY)
|
||||
{
|
||||
multiplier = max_multiplier - (dt/1e6-REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY) * (max_multiplier - min_multiplier) / (REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD - REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY);
|
||||
multiplier = max_multiplier - (dt-REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY) * (max_multiplier - min_multiplier) / (REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD - REQUEST_NEXT_SCHEDULED_SPAN_THRESHOLD_STANDBY);
|
||||
multiplier = std::min(max_multiplier, std::max(min_multiplier, multiplier));
|
||||
}
|
||||
if (dl_speed * .8f > ctx.m_current_speed_down * multiplier)
|
||||
|
Loading…
Reference in New Issue
Block a user