gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14178 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r14178 - gnunet/src/dht
Date: Fri, 14 Jan 2011 19:40:06 +0100

Author: nevans
Date: 2011-01-14 19:40:06 +0100 (Fri, 14 Jan 2011)
New Revision: 14178

Modified:
   gnunet/src/dht/gnunet-dht-driver.c
Log:
printf debugging

Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c  2011-01-14 18:35:49 UTC (rev 14177)
+++ gnunet/src/dht/gnunet-dht-driver.c  2011-01-14 18:40:06 UTC (rev 14178)
@@ -2371,6 +2371,7 @@
   int nearest;
   int bits_match;
   int curr_distance;
+  int count;
   struct GNUNET_TESTING_Daemon *temp_daemon;
   GNUNET_HashCode uid_hash;
 
@@ -2401,11 +2402,15 @@
     {
       nearest = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
num_peers);
       hash_from_uid(nearest, &uid_hash);
-      while (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (bloom, 
&uid_hash))
+      while ((GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (bloom, 
&uid_hash)) && (count < num_peers))
         {
+          GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Peer %d already in bloom (tried 
%d times)\n", nearest, count);
           nearest = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
num_peers);
           hash_from_uid(nearest, &uid_hash);
+          count++;
         }
+      if (count == num_peers)
+        GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Tried %d times to find a peer, 
selecting %d at random!!\n", count, nearest);
     }
 
   return nearest;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]