diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-08-02 09:21:12 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-08-02 09:21:12 +0200 |
commit | 703b21859b69ba2200974afe713f02b0c5574804 (patch) | |
tree | a8e1d61f93a96b72b7dcc0a3bfd15744c388d737 /src/dht | |
parent | 0e002624e8458491a8ea5cd901a6c2cce86ee424 (diff) | |
download | gnunet-703b21859b69ba2200974afe713f02b0c5574804.tar.gz gnunet-703b21859b69ba2200974afe713f02b0c5574804.zip |
-fix DHT loop
Diffstat (limited to 'src/dht')
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 2c30f0b68..ca255310c 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -894,7 +894,7 @@ get_distance (const struct GNUNET_HashCode *target, | |||
894 | unsigned int bucket) | 894 | unsigned int bucket) |
895 | { | 895 | { |
896 | uint64_t lsb = 0; | 896 | uint64_t lsb = 0; |
897 | 897 | ||
898 | for (unsigned int i = bucket + 1; | 898 | for (unsigned int i = bucket + 1; |
899 | (i < sizeof(struct GNUNET_HashCode) * 8) && | 899 | (i < sizeof(struct GNUNET_HashCode) * 8) && |
900 | (i < bucket + 1 + 64); | 900 | (i < bucket + 1 + 64); |
@@ -997,14 +997,15 @@ select_peer (const struct GNUNET_HashCode *key, | |||
997 | chosen = NULL; | 997 | chosen = NULL; |
998 | for (bc = 0; bc <= closest_bucket; bc++) | 998 | for (bc = 0; bc <= closest_bucket; bc++) |
999 | { | 999 | { |
1000 | pos = k_buckets[bc].head; | ||
1001 | count = 0; | 1000 | count = 0; |
1002 | while ( (pos != NULL) && | 1001 | for (pos = k_buckets[bc].head; |
1003 | (count < bucket_size) ) | 1002 | (pos != NULL) && |
1003 | (count < bucket_size); | ||
1004 | pos = pos->next) | ||
1004 | { | 1005 | { |
1005 | unsigned int bucket; | 1006 | unsigned int bucket; |
1006 | uint64_t dist; | 1007 | uint64_t dist; |
1007 | 1008 | ||
1008 | bucket = GNUNET_CRYPTO_hash_matching_bits (key, | 1009 | bucket = GNUNET_CRYPTO_hash_matching_bits (key, |
1009 | &pos->phash); | 1010 | &pos->phash); |
1010 | dist = get_distance (key, | 1011 | dist = get_distance (key, |
@@ -1037,7 +1038,6 @@ select_peer (const struct GNUNET_HashCode *key, | |||
1037 | chosen = NULL; | 1038 | chosen = NULL; |
1038 | } | 1039 | } |
1039 | count++; | 1040 | count++; |
1040 | pos = pos->next; | ||
1041 | } | 1041 | } |
1042 | } | 1042 | } |
1043 | if (NULL == chosen) | 1043 | if (NULL == chosen) |