projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix an always-false if statement which was causing the window border
[u/mdw/putty]
/
sshrand.c
diff --git
a/sshrand.c
b/sshrand.c
index
26fcfe5
..
4c33f4a
100644
(file)
--- a/
sshrand.c
+++ b/
sshrand.c
@@
-4,6
+4,7
@@
#include "putty.h"
#include "ssh.h"
#include "putty.h"
#include "ssh.h"
+#include <assert.h>
/* Collect environmental noise every 5 minutes */
#define NOISE_REGULAR_INTERVAL (5*60*TICKSPERSEC)
/* Collect environmental noise every 5 minutes */
#define NOISE_REGULAR_INTERVAL (5*60*TICKSPERSEC)
@@
-198,9
+199,9
@@
static void random_add_heavynoise_bitbybit(void *noise, int length)
pool.poolpos = i;
}
pool.poolpos = i;
}
-static void random_timer(void *ctx, long now)
+static void random_timer(void *ctx,
unsigned
long now)
{
{
- if (random_active > 0 && now
- next_noise_collection >= 0
) {
+ if (random_active > 0 && now
== next_noise_collection
) {
noise_regular();
next_noise_collection =
schedule_timer(NOISE_REGULAR_INTERVAL, random_timer, &pool);
noise_regular();
next_noise_collection =
schedule_timer(NOISE_REGULAR_INTERVAL, random_timer, &pool);
@@
-225,6
+226,10
@@
void random_ref(void)
void random_unref(void)
{
random_active--;
void random_unref(void)
{
random_active--;
+ assert(random_active >= 0);
+ if (random_active) return;
+
+ expire_timer_context(&pool);
}
int random_byte(void)
}
int random_byte(void)