Rate Limiter calculate method flaw.
Brought to you by:
larytet
In the following code
do
{
int byteRate = (int)(bytes / (timeout * size));
if (byteRate >= bandwidth)
break;
int idx = r.nextInt(size); // spread bursts randomly
required[idx]++; // over the scheduler
bytes += 1;
}
while (true);
break shall occur always because bytes is in reality a
product of timeout, size and bandwidth.