From ddc816a34861a0e090ea84fc945842593c34f45a Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Tue, 6 May 2025 22:24:11 +0200 Subject: Also check for unitialized lookup --- src/proto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/proto.c b/src/proto.c index cd66ead..c7ffd95 100644 --- a/src/proto.c +++ b/src/proto.c @@ -843,12 +843,12 @@ static void recalulate_waketime(struct dht *dht) { } prom_gauge_set(wakeup_time, req_timeout, (const char *[]){"requests"}); - if(dht->wake == 0 || (req_timeout != 0 && difftime(req_timeout, dht->wake) < 0)) { + if(dht->wake == 0 || (req_timeout != 0 && difftime(req_timeout, dht->wake) < 0.0)) { dht->wake = req_timeout; } prom_gauge_set(wakeup_time, dht->lookup.timeout, (const char *[]){"lookup"}); - if(dht->wake == 0 || difftime(dht->lookup.timeout, dht->wake) < 0) { + if(dht->wake == 0 || (dht->lookup.timeout != 0 && difftime(dht->lookup.timeout, dht->wake) < 0)) { dht->wake = dht->lookup.timeout; } } -- cgit v1.2.3