gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r13781 - gnunet/src/dht
Date: Tue, 23 Nov 2010 12:48:54 +0100

Author: nevans
Date: 2010-11-23 12:48:54 +0100 (Tue, 23 Nov 2010)
New Revision: 13781

Modified:
   gnunet/src/dht/gnunet-dht-driver.c
   gnunet/src/dht/gnunet-service-dht.c
Log:
specify total connections desired after find peer requests for dht testing, use 
float for better precision in replication

Modified: gnunet/src/dht/gnunet-dht-driver.c
===================================================================
--- gnunet/src/dht/gnunet-dht-driver.c  2010-11-23 08:50:45 UTC (rev 13780)
+++ gnunet/src/dht/gnunet-dht-driver.c  2010-11-23 11:48:54 UTC (rev 13781)
@@ -506,6 +506,12 @@
 static unsigned long long total_rounds;
 
 /**
+ * Target number of connections (will stop sending find peer
+ * messages when this number is exceeded)
+ */
+static unsigned long long target_total_connections;
+
+/**
  * Number of rounds already run
  */
 static unsigned int rounds_finished;
@@ -1965,16 +1971,17 @@
     }
   else
     {
-      GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Peer count finished (%u 
connections), %u new peers, connection estimate %u (double %u)\n",
+      GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Peer count finished (%u 
connections), %u new peers, connection estimate %u (target %u)\n",
                                             find_peer_context->current_peers,
                                             find_peer_context->current_peers - 
find_peer_context->previous_peers,
                                             connection_estimate(num_peers, 
DEFAULT_BUCKET_SIZE),
-                                            2 * connection_estimate(num_peers, 
DEFAULT_BUCKET_SIZE));
+                                            target_total_connections);
 
       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).rel_value > 0)))
+          
(GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime).rel_value > 0) 
&&
+          (find_peer_context->current_peers < target_total_connections)))
         {
           GNUNET_SCHEDULER_add_now(&schedule_find_peer_requests, 
find_peer_context);
         }
@@ -2018,7 +2025,7 @@
     find_peer_ctx->total = num_peers;
 
   find_peer_ctx->last_sent = find_peer_ctx->total;
-  GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Sending %u find peer messages (goal 
at least %u connections)\n", find_peer_ctx->total, 
connection_estimate(num_peers, DEFAULT_BUCKET_SIZE));
+  GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Sending %u find peer messages (goal 
at least %u connections)\n", find_peer_ctx->total, target_total_connections);
 
   find_peer_offset = GNUNET_TIME_relative_divide(find_peer_delay, 
find_peer_ctx->total);
   for (i = 0; i < find_peer_ctx->total; i++)
@@ -2959,6 +2966,14 @@
       total_rounds = 1;
     }
 
+  if ((GNUNET_SYSERR ==
+        GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 
"target_total_connections",
+                                               &target_total_connections)) ||
+                                               (target_total_connections == 0))
+    {
+      target_total_connections = connection_estimate(num_peers, 
DEFAULT_BUCKET_SIZE);
+    }
+
   topology_str = NULL;
   if ((GNUNET_YES ==
       GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "topology",

Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-11-23 08:50:45 UTC (rev 13780)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-11-23 11:48:54 UTC (rev 13781)
@@ -2727,7 +2727,7 @@
 {
   uint32_t random_value;
   unsigned int forward_count;
-  unsigned int target_value;
+  float target_value;
   unsigned int diameter;
 
   /**




reply via email to

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