aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-13 10:34:15 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-13 10:34:15 +0000
commita7d5d8337347ccfe4165dcdf9647ea0048756a9a (patch)
tree7bdb4ed0881893659e15387f05af3ab5af1aba00 /src/dht/gnunet-service-dht.c
parent5e982700c48152c0a259d2d98a576b319fb68b8f (diff)
downloadgnunet-a7d5d8337347ccfe4165dcdf9647ea0048756a9a.tar.gz
gnunet-a7d5d8337347ccfe4165dcdf9647ea0048756a9a.zip
stuff
Diffstat (limited to 'src/dht/gnunet-service-dht.c')
-rw-r--r--src/dht/gnunet-service-dht.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index ae6041452..0dc9860a0 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -26,6 +26,7 @@
26 * 26 *
27 * TODO: 27 * TODO:
28 * - decide which 'benchmark'/test functions to keep 28 * - decide which 'benchmark'/test functions to keep
29 * - integrate properly with 'block' library (instead of manual bloomfiltering)
29 */ 30 */
30 31
31#include "platform.h" 32#include "platform.h"
@@ -3029,23 +3030,18 @@ get_forward_count (unsigned int hop_count, size_t target_replication)
3029 return 0; 3030 return 0;
3030 } 3031 }
3031 3032
3032 /* FIXME: the smaller we think the network is the more lenient we should be for
3033 * routing right? The estimation below only works if we think we have reasonably
3034 * full routing tables, which for our RR topologies may not be the case!
3035 */
3036 if (hop_count > log_of_network_size_estimate * 2.0) 3033 if (hop_count > log_of_network_size_estimate * 2.0)
3037 { 3034 {
3035 if (GNUNET_YES == paper_forwarding)
3036 {
3037 /* Once we have reached our ideal number of hops, don't stop forwarding! */
3038 return 1;
3039 }
3038#if DEBUG_DHT 3040#if DEBUG_DHT
3039 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3041 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3040 "Hop count too high (est %f, lowest %d), NOT Forwarding request\n", 3042 "Hop count too high (est %f, lowest %d), NOT Forwarding request\n",
3041 log_of_network_size_estimate * 2.0, lowest_bucket); 3043 log_of_network_size_estimate * 2.0, lowest_bucket);
3042#endif 3044#endif
3043 /* FIXME: does this work as intended, isn't the decision to forward or not made based on closeness as well? */
3044 if (GNUNET_YES == paper_forwarding) /* Once we have reached our ideal number of hops, don't stop forwarding! */
3045 {
3046 return 1;
3047 }
3048
3049 return 0; 3045 return 0;
3050 } 3046 }
3051 3047
@@ -3091,18 +3087,18 @@ get_forward_count (unsigned int hop_count, size_t target_replication)
3091 return forward_count; 3087 return forward_count;
3092} 3088}
3093 3089
3094/* 3090
3091/**
3095 * Check whether my identity is closer than any known peers. 3092 * Check whether my identity is closer than any known peers.
3096 * If a non-null bloomfilter is given, check if this is the closest 3093 * If a non-null bloomfilter is given, check if this is the closest
3097 * peer that hasn't already been routed to. 3094 * peer that hasn't already been routed to.
3098 * 3095 *
3099 * @param target hash code to check closeness to 3096 * @param target hash code to check closeness to
3100 * @param bloom bloomfilter, exclude these entries from the decision 3097 * @param bloom bloomfilter, exclude these entries from the decision
3101 * 3098 * @return GNUNET_YES if node location is closest,
3102 * Return GNUNET_YES if node location is closest, GNUNET_NO 3099 * GNUNET_NO otherwise.
3103 * otherwise.
3104 */ 3100 */
3105int 3101static int
3106am_closest_peer (const GNUNET_HashCode * target, 3102am_closest_peer (const GNUNET_HashCode * target,
3107 struct GNUNET_CONTAINER_BloomFilter *bloom) 3103 struct GNUNET_CONTAINER_BloomFilter *bloom)
3108{ 3104{
@@ -3605,7 +3601,6 @@ route_message (const struct GNUNET_MessageHeader *msg,
3605} 3601}
3606 3602
3607 3603
3608
3609/** 3604/**
3610 * Main function that handles whether or not to route a message to other 3605 * Main function that handles whether or not to route a message to other
3611 * peers. 3606 * peers.