From 9e8877cc94e0d3a928b9009fb2b0ffce2c783d7a Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Fri, 22 Sep 2017 07:11:24 +0200 Subject: ipcpd: Fix DHT recursive lookup --- src/ipcpd/normal/dht.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c index af1686a9..711e176a 100644 --- a/src/ipcpd/normal/dht.c +++ b/src/ipcpd/normal/dht.c @@ -721,6 +721,7 @@ static void lookup_update(struct dht * dht, struct contact * c = NULL; size_t n; size_t pos = 0; + bool mod = false; assert(lu); assert(msg); @@ -774,6 +775,7 @@ static void lookup_update(struct dht * dht, if (lu->n_contacts < dht->k) { list_add_tail(&c->next, p); ++lu->n_contacts; + mod = true; } else if (pos == dht->k) { contact_destroy(c); continue; @@ -784,10 +786,11 @@ static void lookup_update(struct dht * dht, struct contact, next); list_del(&d->next); contact_destroy(d); + mod = true; } } - if (lu->out == 0) + if (lu->out == 0 && !mod) lu->state = LU_COMPLETE; else lu->state = LU_UPDATE; -- cgit v1.2.3