diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-08-11 13:11:28 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-08-11 13:11:28 +0000 |
commit | 1b0834b9cb28cc6dfa3984ace3bfcb5d5f57e84f (patch) | |
tree | 11b2fa29411f7ba144b39065dd96585156d0bcb1 /src/dht/gnunet-service-dht.c | |
parent | 550f492457332612d6e4ba0099f8e7a52e163c32 (diff) | |
download | gnunet-1b0834b9cb28cc6dfa3984ace3bfcb5d5f57e84f.tar.gz gnunet-1b0834b9cb28cc6dfa3984ace3bfcb5d5f57e84f.zip |
hopefull stop strict kademlia from being breadth first search of network
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r-- | src/dht/gnunet-service-dht.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index fd62bad21..fd9694fee 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c | |||
@@ -2093,6 +2093,7 @@ if (strict_kademlia == GNUNET_YES) | |||
2093 | for (bc = lowest_bucket; bc < MAX_BUCKETS; bc++) | 2093 | for (bc = lowest_bucket; bc < MAX_BUCKETS; bc++) |
2094 | { | 2094 | { |
2095 | pos = k_buckets[bc].head; | 2095 | pos = k_buckets[bc].head; |
2096 | count = 0; | ||
2096 | while ((pos != NULL) && (count < bucket_size)) | 2097 | while ((pos != NULL) && (count < bucket_size)) |
2097 | { | 2098 | { |
2098 | if (GNUNET_NO == GNUNET_CONTAINER_bloomfilter_test (bloom, &pos->id.hashPubKey)) | 2099 | if (GNUNET_NO == GNUNET_CONTAINER_bloomfilter_test (bloom, &pos->id.hashPubKey)) |
@@ -2104,6 +2105,7 @@ if (strict_kademlia == GNUNET_YES) | |||
2104 | largest_distance = distance; | 2105 | largest_distance = distance; |
2105 | } | 2106 | } |
2106 | } | 2107 | } |
2108 | count++; | ||
2107 | pos = pos->next; | 2109 | pos = pos->next; |
2108 | } | 2110 | } |
2109 | } | 2111 | } |
@@ -2330,7 +2332,8 @@ static int route_message(void *cls, | |||
2330 | message_context->bloom = GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, DHT_BLOOM_K); | 2332 | message_context->bloom = GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, DHT_BLOOM_K); |
2331 | GNUNET_CONTAINER_bloomfilter_add (message_context->bloom, &my_identity.hashPubKey); | 2333 | GNUNET_CONTAINER_bloomfilter_add (message_context->bloom, &my_identity.hashPubKey); |
2332 | 2334 | ||
2333 | if ((stop_on_closest == GNUNET_YES) && (message_context->closest == GNUNET_YES) && (ntohs(msg->type) == GNUNET_MESSAGE_TYPE_DHT_PUT)) | 2335 | if (((stop_on_closest == GNUNET_YES) && (message_context->closest == GNUNET_YES) && (ntohs(msg->type) == GNUNET_MESSAGE_TYPE_DHT_PUT)) |
2336 | || ((strict_kademlia == GNUNET_YES) && (message_context->closest == GNUNET_YES))) | ||
2334 | forward_count = 0; | 2337 | forward_count = 0; |
2335 | 2338 | ||
2336 | #if DEBUG_DHT_ROUTING | 2339 | #if DEBUG_DHT_ROUTING |
@@ -2970,7 +2973,7 @@ void handle_core_connect (void *cls, | |||
2970 | 2973 | ||
2971 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(all_known_peers, &peer->hashPubKey)) | 2974 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(all_known_peers, &peer->hashPubKey)) |
2972 | { | 2975 | { |
2973 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "%s:%s Received %s message for peer %s, but already have peer in RT!", my_short_id, "DHT", "CORE CONNECT", GNUNET_i2s(peer)); | 2976 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s:%s Received %s message for peer %s, but already have peer in RT!", my_short_id, "DHT", "CORE CONNECT", GNUNET_i2s(peer)); |
2974 | return; | 2977 | return; |
2975 | } | 2978 | } |
2976 | 2979 | ||
@@ -3007,7 +3010,7 @@ void handle_core_disconnect (void *cls, | |||
3007 | 3010 | ||
3008 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains(all_known_peers, &peer->hashPubKey)) | 3011 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains(all_known_peers, &peer->hashPubKey)) |
3009 | { | 3012 | { |
3010 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s:%s: do not have peer `%s' in RT, can't disconnect!\n", my_short_id, "DHT", GNUNET_i2s(peer)); | 3013 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s:%s: do not have peer `%s' in RT, can't disconnect!\n", my_short_id, "DHT", GNUNET_i2s(peer)); |
3011 | return; | 3014 | return; |
3012 | } | 3015 | } |
3013 | GNUNET_assert(GNUNET_CONTAINER_multihashmap_contains(all_known_peers, &peer->hashPubKey)); | 3016 | GNUNET_assert(GNUNET_CONTAINER_multihashmap_contains(all_known_peers, &peer->hashPubKey)); |