aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-01-14 18:40:06 +0000
committerNathan S. Evans <evans@in.tum.de>2011-01-14 18:40:06 +0000
commitd49f81bb38f557a674b6bdfcf13fe3181dbab0bc (patch)
treeb952c2d9032cbb52514b3572b9c4768a629b36ee /src
parentcce221d6d05b2508275ac8e594ed54618ea6cb0f (diff)
downloadgnunet-d49f81bb38f557a674b6bdfcf13fe3181dbab0bc.tar.gz
gnunet-d49f81bb38f557a674b6bdfcf13fe3181dbab0bc.zip
printf debugging
Diffstat (limited to 'src')
-rw-r--r--src/dht/gnunet-dht-driver.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c
index 58dad873e..84a473b0d 100644
--- a/src/dht/gnunet-dht-driver.c
+++ b/src/dht/gnunet-dht-driver.c
@@ -2371,6 +2371,7 @@ choose_next_malicious (struct GNUNET_TESTING_PeerGroup *pg, struct GNUNET_CONTAI
2371 int nearest; 2371 int nearest;
2372 int bits_match; 2372 int bits_match;
2373 int curr_distance; 2373 int curr_distance;
2374 int count;
2374 struct GNUNET_TESTING_Daemon *temp_daemon; 2375 struct GNUNET_TESTING_Daemon *temp_daemon;
2375 GNUNET_HashCode uid_hash; 2376 GNUNET_HashCode uid_hash;
2376 2377
@@ -2401,11 +2402,15 @@ choose_next_malicious (struct GNUNET_TESTING_PeerGroup *pg, struct GNUNET_CONTAI
2401 { 2402 {
2402 nearest = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers); 2403 nearest = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers);
2403 hash_from_uid(nearest, &uid_hash); 2404 hash_from_uid(nearest, &uid_hash);
2404 while (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (bloom, &uid_hash)) 2405 while ((GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (bloom, &uid_hash)) && (count < num_peers))
2405 { 2406 {
2407 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Peer %d already in bloom (tried %d times)\n", nearest, count);
2406 nearest = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers); 2408 nearest = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers);
2407 hash_from_uid(nearest, &uid_hash); 2409 hash_from_uid(nearest, &uid_hash);
2410 count++;
2408 } 2411 }
2412 if (count == num_peers)
2413 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Tried %d times to find a peer, selecting %d at random!!\n", count, nearest);
2409 } 2414 }
2410 2415
2411 return nearest; 2416 return nearest;