summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/dht.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-07-29 17:28:46 +0200
committerdimitri staessens <dimitri.staessens@ugent.be>2017-07-29 18:45:32 +0200
commit396cd99e3bc51bbc23387259da028d109349374c (patch)
treea30f99b02b460edeb2f3db094f89a431eddfa1f6 /src/ipcpd/normal/dht.c
parent7407c7e21d2f50481bb81f36ee933094299aea1f (diff)
downloadouroboros-396cd99e3bc51bbc23387259da028d109349374c.tar.gz
ouroboros-396cd99e3bc51bbc23387259da028d109349374c.zip
ipcpd: Fix registration bug in DHT
Diffstat (limited to 'src/ipcpd/normal/dht.c')
-rw-r--r--src/ipcpd/normal/dht.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c
index 9072ee5a..74618658 100644
--- a/src/ipcpd/normal/dht.c
+++ b/src/ipcpd/normal/dht.c
@@ -1357,7 +1357,7 @@ static int kad_add(struct dht * dht,
pthread_rwlock_wrlock(&dht->lock);
- while (--n >= 0) {
+ while (n-- > 0) {
if (contacts[n].id.len != dht->b)
log_warn("Bad key length in contact data.");
@@ -1557,7 +1557,7 @@ static void kad_publish(struct dht * dht,
n = lookup_contact_addrs(lu, addrs);
- while (--n > 0) {
+ while (n-- > 0) {
if (addrs[n] == dht->addr) {
kad_contact_msg_t msg = KAD_CONTACT_MSG__INIT;
msg.id.data = (uint8_t *) key;