mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Always increment delays by at least 1.
This commit is contained in:
parent
1fdf6e5814
commit
85970f7047
@ -3803,11 +3803,14 @@ next_random_exponential_delay(int delay, int max_delay)
|
|||||||
} else if (delay) {
|
} else if (delay) {
|
||||||
max_increment = INT_MAX-1;
|
max_increment = INT_MAX-1;
|
||||||
} else {
|
} else {
|
||||||
max_increment = 1; /* we're always willing to slow down a little. */
|
max_increment = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the + 1 here is so that we include the end of the interval */
|
if (BUG(max_increment < 1))
|
||||||
int increment = crypto_rand_int(max_increment+1);
|
max_increment = 1;
|
||||||
|
|
||||||
|
/* the + 1 here is so that we always wait longer than last time. */
|
||||||
|
int increment = crypto_rand_int(max_increment)+1;
|
||||||
|
|
||||||
if (increment < max_delay - delay)
|
if (increment < max_delay - delay)
|
||||||
return delay + increment;
|
return delay + increment;
|
||||||
|
Loading…
Reference in New Issue
Block a user