diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-01-14 18:49:12 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-01-14 18:49:12 +0000 |
commit | 352df2643355e38dc84ecbd110233e04e2f838a4 (patch) | |
tree | 7e2ee3c744cd3e7d3b9cd9e7c6bda98dc205677f | |
parent | d49f81bb38f557a674b6bdfcf13fe3181dbab0bc (diff) | |
download | gnunet-352df2643355e38dc84ecbd110233e04e2f838a4.tar.gz gnunet-352df2643355e38dc84ecbd110233e04e2f838a4.zip |
all peers match bloom filter. inexplicable.
-rw-r--r-- | src/dht/gnunet-dht-driver.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c index 84a473b0d..354d18c03 100644 --- a/src/dht/gnunet-dht-driver.c +++ b/src/dht/gnunet-dht-driver.c | |||
@@ -2141,6 +2141,7 @@ setup_puts_and_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
2141 | struct TestGetContext *test_get; | 2141 | struct TestGetContext *test_get; |
2142 | uint32_t temp_peer; | 2142 | uint32_t temp_peer; |
2143 | GNUNET_HashCode uid_hash; | 2143 | GNUNET_HashCode uid_hash; |
2144 | int count; | ||
2144 | #if REMEMBER | 2145 | #if REMEMBER |
2145 | int remember[num_puts][num_peers]; | 2146 | int remember[num_puts][num_peers]; |
2146 | memset(&remember, 0, sizeof(int) * num_puts * num_peers); | 2147 | memset(&remember, 0, sizeof(int) * num_puts * num_peers); |
@@ -2163,13 +2164,17 @@ setup_puts_and_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
2163 | /* Don't start PUTs at malicious peers! */ | 2164 | /* Don't start PUTs at malicious peers! */ |
2164 | if (malicious_bloom != NULL) | 2165 | if (malicious_bloom != NULL) |
2165 | { | 2166 | { |
2167 | count = 0; | ||
2166 | hash_from_uid(temp_peer, &uid_hash); | 2168 | hash_from_uid(temp_peer, &uid_hash); |
2167 | while (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test(malicious_bloom, &uid_hash)) | 2169 | while ((GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test(malicious_bloom, &uid_hash)) && (count < num_peers)) |
2168 | { | 2170 | { |
2169 | temp_peer = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers); | 2171 | temp_peer = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers); |
2170 | hash_from_uid(temp_peer, &uid_hash); | 2172 | hash_from_uid(temp_peer, &uid_hash); |
2171 | test_put->daemon = GNUNET_TESTING_daemon_get(pg, temp_peer); | 2173 | test_put->daemon = GNUNET_TESTING_daemon_get(pg, temp_peer); |
2174 | count++; | ||
2172 | } | 2175 | } |
2176 | if (count == num_peers) | ||
2177 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Couldn't find peer not in malicious bloom to select!\n"); | ||
2173 | } | 2178 | } |
2174 | 2179 | ||
2175 | test_put->next = all_puts; | 2180 | test_put->next = all_puts; |
@@ -2191,12 +2196,16 @@ setup_puts_and_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
2191 | if (malicious_bloom != NULL) | 2196 | if (malicious_bloom != NULL) |
2192 | { | 2197 | { |
2193 | hash_from_uid(temp_peer, &uid_hash); | 2198 | hash_from_uid(temp_peer, &uid_hash); |
2194 | while (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test(malicious_bloom, &uid_hash)) | 2199 | count = 0; |
2200 | while ((GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test(malicious_bloom, &uid_hash)) && (count < num_peers)) | ||
2195 | { | 2201 | { |
2196 | temp_peer = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers); | 2202 | temp_peer = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers); |
2197 | hash_from_uid(temp_peer, &uid_hash); | 2203 | hash_from_uid(temp_peer, &uid_hash); |
2198 | test_get->daemon = GNUNET_TESTING_daemon_get(pg, temp_peer); | 2204 | test_get->daemon = GNUNET_TESTING_daemon_get(pg, temp_peer); |
2205 | count++; | ||
2199 | } | 2206 | } |
2207 | if (count == num_peers) | ||
2208 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Couldn't find peer not in malicious bloom to select!\n"); | ||
2200 | } | 2209 | } |
2201 | test_get->next = all_gets; | 2210 | test_get->next = all_gets; |
2202 | all_gets = test_get; | 2211 | all_gets = test_get; |