ob1
authorChristian Grothoff <christian@grothoff.org>
Tue, 25 Oct 2011 13:28:36 +0000 (13:28 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 25 Oct 2011 13:28:36 +0000 (13:28 +0000)
src/dht/gnunet-service-dht_neighbours.c

index 9362d28c5cbb7c03c683f6a7491156d72df7824d..02124b488efbef3125bd835d04f66ce7e6eb13b2 100644 (file)
@@ -1022,7 +1022,7 @@ select_peer (const GNUNET_HashCode *key,
     /* greedy selection (closest peer that is not in bloomfilter) */
     smallest_distance = UINT_MAX;
     chosen = NULL;
-    for (bc = 0; bc < closest_bucket; bc++)
+    for (bc = 0; bc <= closest_bucket; bc++)
     {
       pos = k_buckets[bc].head;
       count = 0;
@@ -1065,7 +1065,7 @@ select_peer (const GNUNET_HashCode *key,
   /* select "random" peer */
   /* count number of peers that are available and not filtered */
   count = 0;
-  for (bc = 0; bc < closest_bucket; bc++)
+  for (bc = 0; bc <= closest_bucket; bc++)
   {
     pos = k_buckets[bc].head;
     while ((pos != NULL) && (count < bucket_size))
@@ -1100,7 +1100,7 @@ select_peer (const GNUNET_HashCode *key,
   /* Now actually choose a peer */
   selected = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, count);
   count = 0;
-  for (bc = 0; bc < closest_bucket; bc++)
+  for (bc = 0; bc <= closest_bucket; bc++)
   {
     pos = k_buckets[bc].head;
     while ((pos != NULL) && (count < bucket_size))