summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/dht.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2017-11-28 18:34:39 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2017-11-28 21:38:02 +0100
commit4be8eb2ef77648e71ce22b465a49991b532d1ace (patch)
tree8af646578191cc764822d8ba051473c5881ec106 /src/ipcpd/normal/dht.c
parent29076c87f659bef5f839d20effe2f633a682dd56 (diff)
downloadouroboros-4be8eb2ef77648e71ce22b465a49991b532d1ace.tar.gz
ouroboros-4be8eb2ef77648e71ce22b465a49991b532d1ace.zip
ipcpd: Only update DHT buckets in running state
This fixes accessing buckets when a DHT join fails. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/ipcpd/normal/dht.c')
-rw-r--r--src/ipcpd/normal/dht.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c
index cd381c5b..836a0c53 100644
--- a/src/ipcpd/normal/dht.c
+++ b/src/ipcpd/normal/dht.c
@@ -2477,7 +2477,8 @@ static void * dht_handle_sdu(void * o)
break;
}
- if (msg->code != KAD_JOIN) {
+ if (msg->code != KAD_JOIN &&
+ dht_get_state(dht) == DHT_RUNNING) {
pthread_rwlock_wrlock(&dht->lock);
if (dht_update_bucket(dht, msg->s_id.data, addr))
log_warn("Failed to update bucket.");