From 4be8eb2ef77648e71ce22b465a49991b532d1ace Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Tue, 28 Nov 2017 18:34:39 +0100 Subject: ipcpd: Only update DHT buckets in running state This fixes accessing buckets when a DHT join fails. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/ipcpd/normal/dht.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/ipcpd/normal') 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."); -- cgit v1.2.3