set peer state properly
[oweals/gnunet.git] / src / testing / test_testing_large_topology.c
index d93f11168bde45e9995b0e846f771fd5e7e131da..9f6b27059739a4507a21112181083f67e7acae5f 100644 (file)
@@ -40,6 +40,10 @@ static float fail_percentage = 0.05;
 
 static int ok;
 
+struct GNUNET_TIME_Relative connect_timeout;
+
+static unsigned long long connect_attempts;
+
 static unsigned long long num_peers;
 
 static unsigned int topology_connections;
@@ -775,6 +779,8 @@ connect_topology ()
         GNUNET_TESTING_connect_topology (pg, connection_topology,
                                          connect_topology_option,
                                          connect_topology_option_modifier,
+                                         connect_timeout,
+                                         connect_attempts,
                                          &topology_creation_finished, NULL);
 #if VERBOSE > 1
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1076,6 +1082,26 @@ run (void *cls,
                                              &num_peers))
     num_peers = DEFAULT_NUM_PEERS;
 
+  if (GNUNET_OK ==
+      GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout",
+                                             &temp_settle))
+    connect_timeout =
+      GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_settle);
+  else
+    {
+      GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", "testing", "connect_timeout");
+      return;
+    }
+
+
+  if (GNUNET_OK !=
+        GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_attempts",
+                                               &connect_attempts))
+    {
+      GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", "testing", "connect_attempts");
+      return;
+    }
+
   main_cfg = cfg;
 
   peers_left = num_peers;
@@ -1103,6 +1129,8 @@ run (void *cls,
 
   GNUNET_assert (num_peers > 0 && num_peers < (unsigned int) -1);
   pg = GNUNET_TESTING_daemons_start (cfg,
+                                     peers_left,
+                                     peers_left / 2,
                                      peers_left,
                                      timeout,
                                      &hostkey_callback, NULL,