gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r13389 - gnunet/src/dht
Date: Tue, 26 Oct 2010 12:33:01 +0200

Author: nevans
Date: 2010-10-26 12:33:01 +0200 (Tue, 26 Oct 2010)
New Revision: 13389

Modified:
   gnunet/src/dht/gnunet-dht-driver.c
   gnunet/src/dht/gnunet-service-dht.c
Log:
binary converge option in dht, make find peer requests more likely to be sent 
early in testing

Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c  2010-10-25 20:25:48 UTC (rev 13388)
+++ gnunet/src/dht/gnunet-dht-driver.c  2010-10-26 10:33:01 UTC (rev 13389)
@@ -1906,7 +1906,8 @@
                                             connection_estimate(num_peers, 
DEFAULT_BUCKET_SIZE),
                                             2 * connection_estimate(num_peers, 
DEFAULT_BUCKET_SIZE));
 
-      if ((find_peer_context->current_peers - 
find_peer_context->previous_peers > FIND_PEER_THRESHOLD) &&
+      if ((find_peer_context->last_sent > 8) &&
+          (find_peer_context->current_peers - 
find_peer_context->previous_peers > FIND_PEER_THRESHOLD) &&
           (find_peer_context->current_peers < 2 * 
connection_estimate(num_peers, DEFAULT_BUCKET_SIZE)) &&
           
(GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime).value > 0))
         {

Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-10-25 20:25:48 UTC (rev 13388)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-10-26 10:33:01 UTC (rev 13389)
@@ -198,7 +198,13 @@
     * the algorithm to hopefully route to closer
     * peers more often.
     */
-   DHT_CONVERGE_RANDOM
+   DHT_CONVERGE_RANDOM,
+
+   /**
+    * Binary convergence, start routing to closest
+    * only after set number of hops.
+    */
+   DHT_CONVERGE_BINARY
 };
 
 /**
@@ -2886,7 +2892,7 @@
 {
   unsigned long long ret;
   unsigned int other_matching_bits;
-  double base_converge_modifier = .1;
+  double base_converge_modifier = .1; /* Value that "looks" good (when 
plotted), have to start somewhere */
   double temp_modifier;
   double calc_value;
   double exponent;
@@ -2931,6 +2937,16 @@
         else
           calc_value = (hops * hops) / curr_max_hops;
         break;
+      case DHT_CONVERGE_BINARY:
+        /**
+         * If below the cutoff, route randomly (return 1),
+         * If above the cutoff, return the maximum possible
+         * value first (always route to closest, because
+         * they are sorted.)
+         */
+        if (hops > converge_modifier) /* Past cutoff */
+          return ULLONG_MAX;
+        /* Fall through */
       default:
         return 1;
     }
@@ -4728,6 +4744,12 @@
     {
       converge_option = DHT_CONVERGE_RANDOM;
     }
+  else if (GNUNET_YES ==
+        GNUNET_CONFIGURATION_get_value_yesno(cfg, "dht",
+                                             "converge_binary"))
+    {
+      converge_option = DHT_CONVERGE_BINARY;
+    }
 
   if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(cfg, "dht_testing", 
"converge_modifier", &converge_modifier_buf))
     {




reply via email to

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