diff options
author | dimitri staessens <[email protected]> | 2017-09-22 07:11:24 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-09-22 07:24:09 +0200 |
commit | 9e8877cc94e0d3a928b9009fb2b0ffce2c783d7a (patch) | |
tree | ae95420400710ef5157ebd999f4675124fa5b197 /src/ipcpd/normal | |
parent | 269ce58f0ffc179d36fa44eb3b205f41e5343f13 (diff) | |
download | ouroboros-9e8877cc94e0d3a928b9009fb2b0ffce2c783d7a.tar.gz ouroboros-9e8877cc94e0d3a928b9009fb2b0ffce2c783d7a.zip |
ipcpd: Fix DHT recursive lookup
Diffstat (limited to 'src/ipcpd/normal')
-rw-r--r-- | src/ipcpd/normal/dht.c | 5 |
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; |