gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r14405 - gnunet/src/testing


From: gnunet
Subject: [GNUnet-SVN] r14405 - gnunet/src/testing
Date: Tue, 15 Feb 2011 12:56:03 +0100

Author: nevans
Date: 2011-02-15 12:56:03 +0100 (Tue, 15 Feb 2011)
New Revision: 14405

Modified:
   gnunet/src/testing/test_testing_topology.c
   gnunet/src/testing/testing_group.c
Log:
change to allow number of outstanding ssh connections to be set separately

Modified: gnunet/src/testing/test_testing_topology.c
===================================================================
--- gnunet/src/testing/test_testing_topology.c  2011-02-15 11:54:55 UTC (rev 
14404)
+++ gnunet/src/testing/test_testing_topology.c  2011-02-15 11:56:03 UTC (rev 
14405)
@@ -26,8 +26,10 @@
 #include "gnunet_core_service.h"
 #include "gnunet_os_lib.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
+#define PROGRESS_BARS GNUNET_YES
+
 #define DELAY_FOR_LOGGING GNUNET_NO
 
 /**
@@ -359,7 +361,7 @@
   if (pos->uid != ntohl (msg->uid))
     return GNUNET_OK;
 
-#if VERBOSE
+#if PROGRESS_BARS
   if ((total_messages_received) % modnum == 0)
     {
       if (total_messages_received == 0)
@@ -390,7 +392,7 @@
 
   if (total_messages_received == expected_messages)
     {
-#if VERBOSE
+#if PROGRESS_BARS
       fprintf (stdout, "100%%]\n");
 #endif
       GNUNET_SCHEDULER_cancel (die_task);
@@ -691,7 +693,7 @@
   struct TestMessageContext *temp_context;
   if (emsg == NULL)
     {
-#if VERBOSE
+#if PROGRESS_BARS
       if ((total_connections) % modnum == 0)
         {
           if (total_connections == 0)
@@ -738,7 +740,7 @@
 
   if (total_connections == expected_connections)
     {
-#if VERBOSE
+#if PROGRESS_BARS
       fprintf (stdout, "100%%]\n");
 #endif
 #if VERBOSE
@@ -748,6 +750,10 @@
 #endif
       modnum = expected_messages / 4;
       dotnum = (expected_messages / 50) + 1;
+      if (modnum == 0)
+        modnum = 1;
+      if (dotnum == 0)
+        dotnum = 1;
       GNUNET_SCHEDULER_cancel (die_task);
       die_task = GNUNET_SCHEDULER_NO_TASK;
 #if DELAY_FOR_LOGGING
@@ -764,7 +770,7 @@
       GNUNET_SCHEDULER_add_delayed (settle_time, &send_test_messages,
                                     test_messages);
 #endif
-#if VERBOSE
+#if PROGRESS_BARS
       fprintf (stdout, "Test message progress: [");
 #endif
 
@@ -821,8 +827,8 @@
                                          connect_timeout,
                                          connect_attempts,
                                          &topology_creation_finished, NULL);
-#if VERBOSE
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+#if PROGRESS_BARS
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                   "Have %d expected connections\n", expected_connections);
 #endif
     }
@@ -836,12 +842,18 @@
       return;
     }
 
-  die_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT,
+  die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+                                           (GNUNET_TIME_UNIT_SECONDS,
+                                            SECONDS_PER_PEER_START * 
num_peers),
                                            &end_badly,
                                            "from connect topology (timeout)");
   modnum = expected_connections / 4;
   dotnum = (expected_connections / 50) + 1;
-#if VERBOSE
+  if (modnum == 0)
+    modnum = 1;
+  if (dotnum == 0)
+    dotnum = 1;
+#if PROGRESS_BARS
   fprintf (stdout, "Peer connection progress: [");
 #endif
 }
@@ -854,7 +866,7 @@
       (pg, topology, blacklist_topology,
        blacklist_transports) != GNUNET_SYSERR)
     {
-#if VERBOSE
+#if PROGRESS_BARS
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Topology set up, now starting peers!\n");
       fprintf (stdout, "Daemon start progress [");
@@ -869,7 +881,9 @@
                                   "from create topology (bad return)");
     }
   GNUNET_SCHEDULER_cancel (die_task);
-  die_task = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT,
+  die_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+                                           (GNUNET_TIME_UNIT_SECONDS,
+                                            SECONDS_PER_PEER_START * 
num_peers),
                                            &end_badly,
                                            "from continue startup (timeout)");
 }
@@ -892,7 +906,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started daemon %llu out of %llu\n",
               (num_peers - peers_left) + 1, num_peers);
 #endif
-#if VERBOSE
+#if PROGRESS_BARS
   if ((num_peers - peers_left) % modnum == 0)
     {
       if (num_peers - peers_left == 0)
@@ -912,7 +926,7 @@
   peers_left--;
   if (peers_left == 0)
     {
-#if VERBOSE
+#if PROGRESS_BARS
       fprintf (stdout, "100%%]\n");
 #endif
 #if VERBOSE
@@ -965,7 +979,7 @@
               num_peers - peers_left, num_peers, GNUNET_i2s (id));
 #endif
 
-#if VERBOSE
+#if PROGRESS_BARS
   if ((num_peers - peers_left) % modnum == 0)
     {
       if (num_peers - peers_left == 0)
@@ -985,7 +999,7 @@
   peers_left--;
   if (peers_left == 0)
     {
-#if VERBOSE
+#if PROGRESS_BARS
       fprintf (stdout, "100%%]\n");
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "All %d hostkeys created, now creating topology!\n",
@@ -1148,7 +1162,11 @@
   peers_left = num_peers;
   modnum = num_peers / 4;
   dotnum = (num_peers / 50) + 1;
-#if VERBOSE
+  if (modnum == 0)
+    modnum = 1;
+  if (dotnum == 0)
+    dotnum = 1;
+#if PROGRESS_BARS
   fprintf (stdout, "Hostkey generation progress: [");
 #endif
   /* Set up a task to end testing if peer start fails */

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2011-02-15 11:54:55 UTC (rev 14404)
+++ gnunet/src/testing/testing_group.c  2011-02-15 11:56:03 UTC (rev 14405)
@@ -56,8 +56,6 @@
 /* Maximum time to delay connect attempt */
 #define MAX_CONNECT_DELAY 300
 
-#define MAX_CONCURRENT_HOSTKEYS 500
-
 /**
  * Which list of peers do we need to modify?
  */
@@ -656,6 +654,11 @@
   unsigned int max_outstanding_connections;
 
   /**
+   * Number of ssh connections to peers (max).
+   */
+  unsigned int max_concurrent_ssh;
+
+  /**
    * Number of connects we are waiting on, allows us to rate limit
    * connect attempts.
    */
@@ -1125,6 +1128,7 @@
  * out of "*port" numbers, return NULL.
  *
  * @param cfg template configuration
+ * @param off the current peer offset
  * @param port port numbers to use, update to reflect
  *             port numbers that were used
  * @param upnum number to make unix domain socket names unique
@@ -1136,6 +1140,7 @@
  */
 static struct GNUNET_CONFIGURATION_Handle *
 make_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
+             uint32_t off,
              uint16_t * port,
              uint32_t * upnum, const char *hostname, uint32_t * fdnum)
 {
@@ -1143,6 +1148,7 @@
   uint16_t orig;
   char *control_host;
   char *allowed_hosts;
+  unsigned long long temp_port;
 
   orig = *port;
   uc.nport = *port;
@@ -1171,20 +1177,28 @@
 
       GNUNET_CONFIGURATION_set_value_string (uc.ret, "core", "ACCEPT_FROM",
                                              allowed_hosts);
-      GNUNET_CONFIGURATION_set_value_string (uc.ret, "core", "UNIXPATH",
-                                             "");
       GNUNET_CONFIGURATION_set_value_string (uc.ret, "transport",
                                              "ACCEPT_FROM", allowed_hosts);
-      GNUNET_CONFIGURATION_set_value_string (uc.ret, "transport", "UNIXPATH",
-                                             "");
       GNUNET_CONFIGURATION_set_value_string (uc.ret, "dht", "ACCEPT_FROM",
                                              allowed_hosts);
-      GNUNET_CONFIGURATION_set_value_string (uc.ret, "dht", "UNIXPATH",
-                                             "");
       GNUNET_CONFIGURATION_set_value_string (uc.ret, "statistics",
                                              "ACCEPT_FROM", allowed_hosts);
-      GNUNET_CONFIGURATION_set_value_string (uc.ret, "statistics", "UNIXPATH",
-                                             "");
+
+      GNUNET_CONFIGURATION_set_value_string (uc.ret, "core", "UNIXPATH", "");
+      GNUNET_CONFIGURATION_set_value_string (uc.ret, "transport", "UNIXPATH", 
"");
+      GNUNET_CONFIGURATION_set_value_string (uc.ret, "dht", "UNIXPATH", "");
+      GNUNET_CONFIGURATION_set_value_string (uc.ret, "statistics", "UNIXPATH", 
"");
+
+
+      if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number(uc.orig, 
"statistics", "port", &temp_port) &&
+          (temp_port != 0) &&
+          (GNUNET_YES !=
+              GNUNET_CONFIGURATION_get_value_yesno (uc.orig, "testing",
+                                                    
"single_statistics_per_host")))
+        {
+          GNUNET_CONFIGURATION_set_value_number (uc.ret, "statistics", "port", 
temp_port + off);
+        }
+
       GNUNET_free_non_null (control_host);
       GNUNET_free (allowed_hosts);
     }
@@ -4614,7 +4628,7 @@
       return;
     }
 
-  if (internal_context->peer->pg->starting < 
internal_context->peer->pg->max_outstanding_connections)
+  if (internal_context->peer->pg->starting < 
internal_context->peer->pg->max_concurrent_ssh)
     {
       internal_context->peer->pg->starting++;
       GNUNET_TESTING_daemon_continue_startup (internal_context->peer->daemon);
@@ -4697,7 +4711,7 @@
   struct ChurnRestartContext *startup_ctx =
     peer_restart_ctx->churn_restart_ctx;
 
-  if (startup_ctx->outstanding > startup_ctx->pg->max_outstanding_connections)
+  if (startup_ctx->outstanding > startup_ctx->pg->max_concurrent_ssh)
     GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                   (GNUNET_TIME_UNIT_MILLISECONDS, 100),
                                   &schedule_churn_restart, peer_restart_ctx);
@@ -4721,7 +4735,7 @@
       return;
     }
 
-  if (internal_context->peer->pg->starting < MAX_CONCURRENT_HOSTKEYS)
+  if (internal_context->peer->pg->starting < 
internal_context->peer->pg->max_concurrent_ssh)
     {
       internal_context->peer->pg->starting++;
       internal_context->peer->daemon =
@@ -4774,7 +4788,9 @@
  * @param cfg configuration template to use
  * @param total number of daemons to start
  * @param max_concurrent_connections for testing, how many peers can
- *                                   we connect to simultaneously
+*                                   we connect to simultaneously
+ * @param max_concurrent_ssh when starting with ssh, how many ssh
+ *        connections will we allow at once (based on remote hosts allowed!)
  * @param timeout total time allowed for peers to start
  * @param hostkey_callback function to call on each peers hostkey generation
  *        if NULL, peers will be started by this call, if non-null,
@@ -4794,6 +4810,7 @@
 GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
                               unsigned int total,
                               unsigned int max_concurrent_connections,
+                              unsigned int max_concurrent_ssh,
                               struct GNUNET_TIME_Relative timeout,
                               GNUNET_TESTING_NotifyHostkeyCreated
                               hostkey_callback, void *hostkey_cls,
@@ -4847,6 +4864,7 @@
   pg->max_timeout = GNUNET_TIME_relative_to_absolute (timeout);
   pg->peers = GNUNET_malloc (total * sizeof (struct PeerData));
   pg->max_outstanding_connections = max_concurrent_connections;
+  pg->max_concurrent_ssh = max_concurrent_ssh;
   if (NULL != hostnames)
     {
       off = 0;
@@ -4935,7 +4953,6 @@
                                                                     
&baseservicehome));
   for (i = 0; i < pg->num_hosts; i++)
     {
-
       if (NULL != pg->hosts[i].username)
         GNUNET_asprintf (&arg, "address@hidden", pg->hosts[i].username, 
pg->hosts[i].hostname);
       else
@@ -5003,6 +5020,7 @@
           username = pg->hosts[off % hostcnt].username;
           sshport = pg->hosts[off % hostcnt].sshport;
           pcfg = make_config (cfg,
+                              off,
                               &pg->hosts[off % hostcnt].minport,
                               &upnum, hostname, &fdnum);
         }
@@ -5011,7 +5029,7 @@
           hostname = NULL;
           username = NULL;
           sshport = 0;
-          pcfg = make_config (cfg, &minport, &upnum, hostname, &fdnum);
+          pcfg = make_config (cfg, off, &minport, &upnum, hostname, &fdnum);
         }
 
       if (NULL == pcfg)
@@ -5252,7 +5270,7 @@
   shutdown_ctx = peer_shutdown_ctx->shutdown_ctx;
   GNUNET_assert (shutdown_ctx != NULL);
   churn_ctx = (struct ChurnContext *)shutdown_ctx->cb_cls;
-  if (shutdown_ctx->outstanding > churn_ctx->pg->max_outstanding_connections)
+  if (shutdown_ctx->outstanding > churn_ctx->pg->max_concurrent_ssh)
     GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                   (GNUNET_TIME_UNIT_MILLISECONDS, 100),
                                   &schedule_churn_shutdown_task,
@@ -5602,7 +5620,7 @@
   shutdown_ctx = peer_shutdown_ctx->shutdown_ctx;
   GNUNET_assert (shutdown_ctx != NULL);
 
-  if (shutdown_ctx->outstanding > 
shutdown_ctx->pg->max_outstanding_connections)
+  if (shutdown_ctx->outstanding > shutdown_ctx->pg->max_concurrent_ssh)
     GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
                                   (GNUNET_TIME_UNIT_MILLISECONDS, 100),
                                   &schedule_shutdown_task, peer_shutdown_ctx);




reply via email to

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