The dht_get_state() function should be used to get the state of the
DHT. This fixes bug #4.
Signed-off-by: Dimitri Staessens <dimitri.staessens@xxxxxxxx>
---
src/ipcpd/normal/dht.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c
index 2577efc..a3f6308 100644
--- a/src/ipcpd/normal/dht.c
+++ b/src/ipcpd/normal/dht.c
@@ -2538,7 +2538,8 @@ static void * dht_handle_sdu(void * o)
if (msg->code != KAD_JOIN) {
pthread_rwlock_wrlock(&dht->lock);
- if (dht->state == DHT_JOINING && dht->buckets == NULL)
{
+ if (dht_get_state(dht) == DHT_JOINING &&
+ dht->buckets == NULL) {
pthread_rwlock_unlock(&dht->lock);
break;
}
--
2.16.2