1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-26 01:32:25 +00:00

Run the random pool setup and teardown functions with random_active

nonzero rather than zero.

[originally from svn r9935]
This commit is contained in:
Simon Tatham 2013-07-19 17:44:42 +00:00
parent b4adf61bc7
commit 311761e245

View File

@ -213,24 +213,25 @@ void random_ref(void)
if (!random_active) { if (!random_active) {
memset(&pool, 0, sizeof(pool)); /* just to start with */ memset(&pool, 0, sizeof(pool)); /* just to start with */
random_active++;
noise_get_heavy(random_add_heavynoise_bitbybit); noise_get_heavy(random_add_heavynoise_bitbybit);
random_stir(); random_stir();
next_noise_collection = next_noise_collection =
schedule_timer(NOISE_REGULAR_INTERVAL, random_timer, &pool); schedule_timer(NOISE_REGULAR_INTERVAL, random_timer, &pool);
} }
random_active++;
} }
void random_unref(void) void random_unref(void)
{ {
random_active--; assert(random_active > 0);
assert(random_active >= 0); if (random_active == 1) {
if (random_active) return; random_save_seed();
expire_timer_context(&pool); expire_timer_context(&pool);
} }
random_active--;
}
int random_byte(void) int random_byte(void)
{ {