*
* TODO:
* - decide which 'benchmark'/test functions to keep
- * - estiamte_diameter?
*/
#include "platform.h"
route_message (msg, msg_ctx);
}
-/**
- * Estimate the diameter of the network based
- * on how many buckets are currently in use.
- * Concept here is that the diameter of the network
- * is roughly the distance a message must travel in
- * order to reach its intended destination. Since
- * at each hop we expect to get one bit closer, and
- * we have one bit per bucket, the number of buckets
- * in use should be the largest number of hops for
- * a successful message. (of course, this assumes we
- * know all peers in the network!)
- *
- * @return ballpark diameter figure
- */
-static unsigned int
-estimate_diameter ()
-{
- return MAX_BUCKETS - lowest_bucket;
-}
/**
* To how many peers should we (on average)
uint32_t random_value;
unsigned int forward_count;
float target_value;
- unsigned int diameter;
-
- diameter = estimate_diameter ();
/**
* If we are behaving in strict kademlia mode, send multiple initial requests,
if (hop_count > log_of_network_size_estimate * 2.0)
{
#if DEBUG_DHT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "`%s:%s': Hop count too high (est %d, lowest %d), NOT Forwarding request\n",
- my_short_id, "DHT", estimate_diameter (), lowest_bucket);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Hop count too high (est %f, lowest %d), NOT Forwarding request\n",
+ log_of_network_size_estimate * 2.0, lowest_bucket);
#endif
/* FIXME: does this work as intended, isn't the decision to forward or not made based on closeness as well? */
if (GNUNET_YES == paper_forwarding) /* Once we have reached our ideal number of hops, don't stop forwarding! */
{
/* FIXME: re-run replication trials with this formula */
target_value =
- 1 + (target_replication - 1.0) / (diameter +
+ 1 + (target_replication - 1.0) / (log_of_network_size_estimate +
((float) (target_replication - 1.0) *
hop_count));
/* Set forward count to floor of target_value */
random_value = 0;
forward_count = 1;
target_value =
- target_replication / (diameter +
+ target_replication / (log_of_network_size_estimate +
((float) target_replication * hop_count));
if (target_value > 1)
{
(GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX));
new_msg_ctx->replication = ntohl (DEFAULT_PUT_REPLICATION);
new_msg_ctx->msg_options = ntohl (0);
- new_msg_ctx->network_size = estimate_diameter ();
+ new_msg_ctx->network_size = log_of_network_size_estimate;
new_msg_ctx->peer = &my_identity;
new_msg_ctx->bloom =
GNUNET_CONTAINER_bloomfilter_init (NULL, DHT_BLOOM_SIZE, DHT_BLOOM_K);
(GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX));
msg_ctx.replication = ntohl (DHT_DEFAULT_FIND_PEER_REPLICATION);
msg_ctx.msg_options = ntohl (0);
- msg_ctx.network_size = estimate_diameter ();
+ msg_ctx.network_size = log_of_network_size_estimate;
msg_ctx.peer = &my_identity;
msg_ctx.importance = DHT_DEFAULT_P2P_IMPORTANCE;
msg_ctx.timeout = DHT_DEFAULT_P2P_TIMEOUT;
(GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX));
msg_ctx.replication = ntohl (DHT_DEFAULT_FIND_PEER_REPLICATION);
msg_ctx.msg_options = ntohl (0);
- msg_ctx.network_size = estimate_diameter ();
+ msg_ctx.network_size = log_of_network_size_estimate;
msg_ctx.peer = &my_identity;
msg_ctx.importance = DHT_DEFAULT_P2P_IMPORTANCE;
msg_ctx.timeout = DHT_DEFAULT_P2P_TIMEOUT;
(GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX));
msg_ctx.replication = DHT_DEFAULT_FIND_PEER_REPLICATION;
msg_ctx.msg_options = DHT_DEFAULT_FIND_PEER_OPTIONS;
- msg_ctx.network_size = estimate_diameter ();
+ msg_ctx.network_size = log_of_network_size_estimate;
msg_ctx.peer = &my_identity;
msg_ctx.importance = DHT_DEFAULT_FIND_PEER_IMPORTANCE;
msg_ctx.timeout = DHT_DEFAULT_FIND_PEER_TIMEOUT;
sizeof (struct GNUNET_PeerIdentity));
msg_ctx.path_history_len = 1;
}
- msg_ctx.network_size = estimate_diameter ();
+ msg_ctx.network_size = log_of_network_size_estimate;
msg_ctx.peer = &my_identity; /* FIXME bart NULL? Fix doxygen? */
msg_ctx.importance = DHT_DEFAULT_P2P_IMPORTANCE + 4; /* Make local routing a higher priority */
msg_ctx.timeout = DHT_DEFAULT_P2P_TIMEOUT;