gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r14180 - gnunet/src/dht
Date: Fri, 14 Jan 2011 19:49:12 +0100

Author: nevans
Date: 2011-01-14 19:49:12 +0100 (Fri, 14 Jan 2011)
New Revision: 14180

Modified:
   gnunet/src/dht/gnunet-dht-driver.c
Log:
all peers match bloom filter. inexplicable.

Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c  2011-01-14 18:45:16 UTC (rev 14179)
+++ gnunet/src/dht/gnunet-dht-driver.c  2011-01-14 18:49:12 UTC (rev 14180)
@@ -2141,6 +2141,7 @@
   struct TestGetContext *test_get;
   uint32_t temp_peer;
   GNUNET_HashCode uid_hash;
+  int count;
 #if REMEMBER
   int remember[num_puts][num_peers];
   memset(&remember, 0, sizeof(int) * num_puts * num_peers);
@@ -2163,13 +2164,17 @@
       /* Don't start PUTs at malicious peers! */
       if (malicious_bloom != NULL)
         {
+          count = 0;
           hash_from_uid(temp_peer, &uid_hash);
-          while (GNUNET_YES == 
GNUNET_CONTAINER_bloomfilter_test(malicious_bloom, &uid_hash))
+          while ((GNUNET_YES == 
GNUNET_CONTAINER_bloomfilter_test(malicious_bloom, &uid_hash)) && (count < 
num_peers))
           {
             temp_peer = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
num_peers);
             hash_from_uid(temp_peer, &uid_hash);
             test_put->daemon = GNUNET_TESTING_daemon_get(pg, temp_peer);
+            count++;
           }
+          if (count == num_peers)
+            GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Couldn't find peer not in 
malicious bloom to select!\n");
         }
 
       test_put->next = all_puts;
@@ -2191,12 +2196,16 @@
       if (malicious_bloom != NULL)
         {
           hash_from_uid(temp_peer, &uid_hash);
-          while (GNUNET_YES == 
GNUNET_CONTAINER_bloomfilter_test(malicious_bloom, &uid_hash))
+          count = 0;
+          while ((GNUNET_YES == 
GNUNET_CONTAINER_bloomfilter_test(malicious_bloom, &uid_hash)) && (count < 
num_peers))
           {
             temp_peer = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
num_peers);
             hash_from_uid(temp_peer, &uid_hash);
             test_get->daemon = GNUNET_TESTING_daemon_get(pg, temp_peer);
+            count++;
           }
+          if (count == num_peers)
+            GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Couldn't find peer not in 
malicious bloom to select!\n");
         }
       test_get->next = all_gets;
       all_gets = test_get;




reply via email to

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