summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-09-22 07:11:24 +0200
committerdimitri staessens <dimitri.staessens@ugent.be>2017-09-22 07:24:09 +0200
commit9e8877cc94e0d3a928b9009fb2b0ffce2c783d7a (patch)
treeae95420400710ef5157ebd999f4675124fa5b197 /src/ipcpd/normal
parent269ce58f0ffc179d36fa44eb3b205f41e5343f13 (diff)
downloadouroboros-9e8877cc94e0d3a928b9009fb2b0ffce2c783d7a.tar.gz
ouroboros-9e8877cc94e0d3a928b9009fb2b0ffce2c783d7a.zip
ipcpd: Fix DHT recursive lookup
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r--src/ipcpd/normal/dht.c5
1 files changed, 4 insertions, 1 deletions
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;