summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-09-22 07:37:54 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-09-22 07:37:54 +0000
commitb4b7f797932df711ebc5426f6b00013227aad5cb (patch)
treeae95420400710ef5157ebd999f4675124fa5b197
parent269ce58f0ffc179d36fa44eb3b205f41e5343f13 (diff)
parent9e8877cc94e0d3a928b9009fb2b0ffce2c783d7a (diff)
downloadouroboros-b4b7f797932df711ebc5426f6b00013227aad5cb.tar.gz
ouroboros-b4b7f797932df711ebc5426f6b00013227aad5cb.zip
Merged in dstaesse/ouroboros/be-dht-update-fix (pull request #611)
ipcpd: Fix DHT recursive lookup
-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;