From c46781095ec64fbc4f8cf6097ca70b594a68c583 Mon Sep 17 00:00:00 2001 From: Jesper Jensen Date: Sat, 25 Sep 2021 21:04:29 +0200 Subject: Add timeout --- src/routing.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/routing.c') diff --git a/src/routing.c b/src/routing.c index 64d5353..f26f1ba 100644 --- a/src/routing.c +++ b/src/routing.c @@ -136,7 +136,7 @@ bool routing_offer(struct nodeid* id, struct entry **dest) { uint16_t baseIndex = base_bucket(id); int8_t inBucketIndex = scan(baseIndex, id); - if(inBucketIndex == -1) { + if(inBucketIndex < 0) { // The bucket either already contains the node, or it has no more space return false; } @@ -210,7 +210,7 @@ void routing_oldest(struct entry** dest) { continue; } - if(difftime((*dest)->last, entry->last) > 0.0) { + if(difftime((*dest)->expire, entry->expire) > 0.0) { *dest = entry; } } -- cgit v1.2.3