gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r14257 - gnunet/src/dht
Date: Tue, 25 Jan 2011 14:36:38 +0100

Author: nevans
Date: 2011-01-25 14:36:38 +0100 (Tue, 25 Jan 2011)
New Revision: 14257

Modified:
   gnunet/src/dht/gnunet-dht-driver.c
Log:
bloom size fix

Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c  2011-01-25 13:26:08 UTC (rev 14256)
+++ gnunet/src/dht/gnunet-dht-driver.c  2011-01-25 13:36:38 UTC (rev 14257)
@@ -2412,6 +2412,7 @@
     {
       nearest = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
num_peers);
       hash_from_uid(nearest, &uid_hash);
+      count = 0;
       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);
@@ -2710,8 +2711,8 @@
   int count;
   int ret;
   int line_number;
+  int k;
 
-
   config = cfg;
   rounds_finished = 0;
   memset(&trial_info, 0, sizeof(struct GNUNET_DHTLOG_TrialInfo));
@@ -3077,8 +3078,13 @@
     }
 
   /* Create the bloomfilter for choosing which peers to set malicious */
+
+  /* Bloomfilter size must be 2^k for some integer k */
+  k = 1;
+  while (1 << k < malicious_droppers)
+    k++;
   if (malicious_droppers > 0)
-    malicious_bloom = GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_K * 
malicious_droppers, DHT_BLOOM_K);
+    malicious_bloom = GNUNET_CONTAINER_bloomfilter_init (NULL, 1 << k, 
DHT_BLOOM_K);
 
   /* The normal behavior of the DHT is to do find peer requests
    * on its own.  Only if this is explicitly turned off should




reply via email to

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