clique topology optimization, progress meter for connecting
[oweals/gnunet.git] / src / testing / testing_group.c
index 90aad3ca205666ec4ebb70e9735a0ed1a6741d71..5837930ee282e6e89d6855d723cc2100439a704a 100644 (file)
@@ -40,6 +40,8 @@
 
 #define USE_SEND_HELLOS GNUNET_NO
 
+#define TOPOLOGY_HACK GNUNET_YES
+
 /**
  * Lowest port used for GNUnet testing.  Should be high enough to not
  * conflict with other applications running on the hosts but be low
@@ -87,7 +89,8 @@ typedef unsigned int (*GNUNET_TESTING_ConnectionProcessor) (struct
                                                             first,
                                                             unsigned int
                                                             second,
-                                                            enum PeerLists list);
+                                                            enum PeerLists list,
+                                                            unsigned int check);
 
 
 /**
@@ -956,6 +959,25 @@ struct DFSContext
   unsigned int current;
 };
 
+/**
+ * Simple struct to keep track of progress, and print a
+ * nice little percentage meter for long running tasks.
+ */
+struct ProgressMeter
+{
+  unsigned int total;
+
+  unsigned int modnum;
+
+  unsigned int dotnum;
+
+  unsigned int completed;
+
+  int print;
+
+  char *startup_string;
+};
+
 #if !OLD
 /**
  * Convert unique ID to hash code.
@@ -987,6 +1009,102 @@ uid_from_hash (const GNUNET_HashCode * hash, uint32_t * uid)
 static struct GNUNET_CORE_MessageHandler no_handlers[] = { {NULL, 0, 0} };
 #endif
 
+/**
+ * Create a meter to keep track of the progress of some task.
+ *
+ * @param total the total number of items to complete
+ * @param start_string a string to prefix the meter with (if printing)
+ * @param print GNUNET_YES to print the meter, GNUNET_NO to count
+ *              internally only
+ *
+ * @return the progress meter
+ */
+static struct ProgressMeter *
+create_meter(unsigned int total, char * start_string, int print)
+{
+  struct ProgressMeter *ret;
+  ret = GNUNET_malloc(sizeof(struct ProgressMeter));
+  ret->print = print;
+  ret->total = total;
+  ret->modnum = total / 4;
+  ret->dotnum = (total / 50) + 1;
+  if (start_string != NULL)
+    ret->startup_string = GNUNET_strdup(start_string);
+  else
+    ret->startup_string = GNUNET_strdup("");
+
+  return ret;
+}
+
+/**
+ * Update progress meter (increment by one).
+ *
+ * @param meter the meter to update and print info for
+ *
+ * @return GNUNET_YES if called the total requested,
+ *         GNUNET_NO if more items expected
+ */
+static int
+update_meter(struct ProgressMeter *meter)
+{
+  if (meter->print == GNUNET_YES)
+    {
+      if (meter->completed % meter->modnum == 0)
+        {
+          if (meter->completed == 0)
+            {
+              fprintf(stdout, "%sProgress: [0%%", meter->startup_string);
+            }
+          else
+            fprintf(stdout, "%d%%", (int) (((float) meter->completed
+                / meter->total) * 100));
+        }
+      else if (meter->completed % meter->dotnum == 0)
+        fprintf(stdout, ".");
+
+      if (meter->completed + 1 == meter->total)
+        fprintf(stdout, "%d%%]\n", 100);
+      fflush(stdout);
+    }
+  meter->completed++;
+
+  if (meter->completed == meter->total)
+    return GNUNET_YES;
+  if (meter->completed > meter->total)
+    GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Progress meter overflow!!\n");
+  return GNUNET_NO;
+}
+
+/**
+ * Reset progress meter.
+ *
+ * @param meter the meter to reset
+ *
+ * @return GNUNET_YES if meter reset,
+ *         GNUNET_SYSERR on error
+ */
+static int
+reset_meter(struct ProgressMeter *meter)
+{
+  if (meter == NULL)
+    return GNUNET_SYSERR;
+
+  meter->completed = 0;
+  return GNUNET_YES;
+}
+
+/**
+ * Release resources for meter
+ *
+ * @param meter the meter to free
+ */
+static void
+free_meter(struct ProgressMeter *meter)
+{
+  GNUNET_free_non_null (meter->startup_string);
+  GNUNET_free (meter);
+}
+
 /**
  * Get a topology from a string input.
  *
@@ -1343,6 +1461,7 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
  * @param first index of the first peer
  * @param second index of the second peer
  * @param list the peer list to use
+ * @param check UNUSED
  *
  * @return the number of connections added (can be 0, 1 or 2)
  *
@@ -1350,7 +1469,7 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg,
 static unsigned int
 remove_connections (struct GNUNET_TESTING_PeerGroup *pg,
                    unsigned int first, unsigned int second,
-                   enum PeerLists list)
+                   enum PeerLists list, unsigned int check)
 {
   int removed;
 #if OLD
@@ -1455,6 +1574,8 @@ remove_connections (struct GNUNET_TESTING_PeerGroup *pg,
  * @param first index of the first peer
  * @param second index of the second peer
  * @param list the list type that we should modify
+ * @param check GNUNET_YES to check lists before adding
+ *              GNUNET_NO to force add
  *
  * @return the number of connections added (can be 0, 1 or 2)
  *
@@ -1462,7 +1583,8 @@ remove_connections (struct GNUNET_TESTING_PeerGroup *pg,
 static unsigned int
 add_connections (struct GNUNET_TESTING_PeerGroup *pg,
                  unsigned int first, unsigned int second,
-                 enum PeerLists list)
+                 enum PeerLists list,
+                 unsigned int check)
 {
   int added;
   int add_first;
@@ -1519,26 +1641,29 @@ add_connections (struct GNUNET_TESTING_PeerGroup *pg,
   add_first = GNUNET_YES;
   add_second = GNUNET_YES;
 
-  first_iter = *first_list;
-  while (first_iter != NULL)
+  if (check == GNUNET_YES)
     {
-      if (first_iter->index == second)
+      first_iter = *first_list;
+      while (first_iter != NULL)
         {
-          add_first = GNUNET_NO;
-          break;
+          if (first_iter->index == second)
+            {
+              add_first = GNUNET_NO;
+              break;
+            }
+          first_iter = first_iter->next;
         }
-      first_iter = first_iter->next;
-    }
 
-  second_iter = *second_list;
-  while (second_iter != NULL)
-    {
-      if (second_iter->index == first)
+      second_iter = *second_list;
+      while (second_iter != NULL)
         {
-          add_second = GNUNET_NO;
-          break;
+          if (second_iter->index == first)
+            {
+              add_second = GNUNET_NO;
+              break;
+            }
+          second_iter = second_iter->next;
         }
-      second_iter = second_iter->next;
     }
 #else
   if (GNUNET_NO ==
@@ -1632,7 +1757,7 @@ create_scale_free (struct GNUNET_TESTING_PeerGroup *pg,
   GNUNET_assert (pg->total > 1);
 
   /* Add a connection between the first two nodes */
-  total_connections = proc (pg, 0, 1, list);
+  total_connections = proc (pg, 0, 1, list, GNUNET_YES);
 
   for (outer_count = 1; outer_count < pg->total; outer_count++)
     {
@@ -1657,7 +1782,7 @@ create_scale_free (struct GNUNET_TESTING_PeerGroup *pg,
               GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                           "Connecting peer %d to peer %d\n", outer_count, i);
 #endif
-              total_connections += proc (pg, outer_count, i, list);
+              total_connections += proc (pg, outer_count, i, list, GNUNET_YES);
             }
         }
     }
@@ -1784,7 +1909,7 @@ create_small_world_ring (struct GNUNET_TESTING_PeerGroup *pg,
                     GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
                                               pg->total);
                 }
-              smallWorldConnections += proc (pg, i, randomPeer, list);
+              smallWorldConnections += proc (pg, i, randomPeer, list, GNUNET_YES);
             }
           else
             {
@@ -1793,7 +1918,7 @@ create_small_world_ring (struct GNUNET_TESTING_PeerGroup *pg,
                 {
                   nodeToConnect = nodeToConnect - pg->total;
                 }
-              connect_attempts += proc (pg, i, nodeToConnect, list);
+              connect_attempts += proc (pg, i, nodeToConnect, list, GNUNET_YES);
             }
         }
 
@@ -1840,12 +1965,67 @@ create_nated_internet (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_free (p_string);
     }
 
+  cutoff = (unsigned int) (nat_percentage * pg->total);
+  connect_attempts = 0;
+  for (outer_count = 0; outer_count < pg->total - 1; outer_count++)
+    {
+      for (inner_count = outer_count + 1; inner_count < pg->total;
+           inner_count++)
+        {
+          if ((outer_count > cutoff) || (inner_count > cutoff))
+            {
+#if VERBOSE_TESTING
+              GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                          "Connecting peer %d to peer %d\n",
+                          outer_count, inner_count);
+#endif
+              connect_attempts += proc (pg, outer_count, inner_count, list, GNUNET_YES);
+            }
+        }
+    }
+  return connect_attempts;
+}
+
+#if TOPOLOGY_HACK
+/**
+ * Create a topology given a peer group (set of running peers)
+ * and a connection processor.
+ *
+ * @param pg the peergroup to create the topology on
+ * @param proc the connection processor to call to actually set
+ *        up connections between two peers
+ * @param list the peer list to use
+ *
+ * @return the number of connections that were set up
+ *
+ */
+static unsigned int
+create_nated_internet_copy (struct GNUNET_TESTING_PeerGroup *pg,
+                            GNUNET_TESTING_ConnectionProcessor proc,
+                            enum PeerLists list)
+{
+  unsigned int outer_count, inner_count;
+  unsigned int cutoff;
+  int connect_attempts;
+  double nat_percentage;
+  char *p_string;
 
+  nat_percentage = 0.6;         /* FIXME: default percentage? */
+  if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (pg->cfg,
+                                                          "TESTING",
+                                                          "PERCENTAGE",
+                                                          &p_string))
+    {
+      if (sscanf (p_string, "%lf", &nat_percentage) != 1)
+        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                    _
+                    ("Invalid value `%s' for option `%s' in section `%s': expected float\n"),
+                    p_string, "PERCENTAGE", "TESTING");
+      GNUNET_free (p_string);
+    }
 
   cutoff = (unsigned int) (nat_percentage * pg->total);
-
   connect_attempts = 0;
-
   for (outer_count = 0; outer_count < pg->total - 1; outer_count++)
     {
       for (inner_count = outer_count + 1; inner_count < pg->total;
@@ -1858,14 +2038,15 @@ create_nated_internet (struct GNUNET_TESTING_PeerGroup *pg,
                           "Connecting peer %d to peer %d\n",
                           outer_count, inner_count);
 #endif
-              connect_attempts += proc (pg, outer_count, inner_count, list);
+              connect_attempts += proc (pg, outer_count, inner_count, list, GNUNET_YES);
+              add_connections(pg, outer_count, inner_count, ALLOWED, GNUNET_YES);
             }
         }
     }
 
   return connect_attempts;
-
 }
+#endif
 
 /**
  * Create a topology given a peer group (set of running peers)
@@ -1973,7 +2154,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg,
       else
         nodeToConnect = i - cols + 1;
 
-      connect_attempts += proc (pg, i, nodeToConnect, list);
+      connect_attempts += proc (pg, i, nodeToConnect, list, GNUNET_YES);
 
       if (i < cols)
         {
@@ -1985,7 +2166,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg,
         nodeToConnect = i - cols;
 
       if (nodeToConnect < pg->total)
-        connect_attempts += proc (pg, i, nodeToConnect, list);
+        connect_attempts += proc (pg, i, nodeToConnect, list, GNUNET_YES);
     }
   natLog = log (pg->total);
 #if VERBOSE_TESTING > 2
@@ -2027,7 +2208,7 @@ create_small_world (struct GNUNET_TESTING_PeerGroup *pg,
                     ((double) UINT64_MAX);
                   /* If random < probability, then connect the two nodes */
                   if (random < probability)
-                    smallWorldConnections += proc (pg, j, k, list);
+                    smallWorldConnections += proc (pg, j, k, list, GNUNET_YES);
 
                 }
             }
@@ -2095,7 +2276,7 @@ create_erdos_renyi (struct GNUNET_TESTING_PeerGroup *pg,
 #endif
           if (temp_rand < probability)
             {
-              connect_attempts += proc (pg, outer_count, inner_count, list);
+              connect_attempts += proc (pg, outer_count, inner_count, list, GNUNET_YES);
             }
         }
     }
@@ -2171,7 +2352,7 @@ create_2d_torus (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Connecting peer %d to peer %d\n", i, nodeToConnect);
 #endif
-      connect_attempts += proc (pg, i, nodeToConnect, list);
+      connect_attempts += proc (pg, i, nodeToConnect, list, GNUNET_YES);
 
       /* Second connect to the node immediately above */
       if (i < cols)
@@ -2189,7 +2370,7 @@ create_2d_torus (struct GNUNET_TESTING_PeerGroup *pg,
           GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                       "Connecting peer %d to peer %d\n", i, nodeToConnect);
 #endif
-          connect_attempts += proc (pg, i, nodeToConnect, list);
+          connect_attempts += proc (pg, i, nodeToConnect, list, GNUNET_YES);
         }
 
     }
@@ -2206,20 +2387,25 @@ create_2d_torus (struct GNUNET_TESTING_PeerGroup *pg,
  * @param proc the connection processor to call to actually set
  *        up connections between two peers
  * @param list the peer list to use
+ * @param check does the connection processor need to check before
+ *              performing an action on the list?
  *
  * @return the number of connections that were set up
  *
  */
 static unsigned int
 create_clique (struct GNUNET_TESTING_PeerGroup *pg,
-               GNUNET_TESTING_ConnectionProcessor proc, enum PeerLists list)
+               GNUNET_TESTING_ConnectionProcessor proc,
+               enum PeerLists list,
+               unsigned int check)
 {
   unsigned int outer_count;
   unsigned int inner_count;
   int connect_attempts;
-
+  struct ProgressMeter *conn_meter;
   connect_attempts = 0;
 
+  conn_meter = create_meter((((pg->total * pg->total) + pg->total) / 2) - pg->total, "Create Clique ", GNUNET_YES);
   for (outer_count = 0; outer_count < pg->total - 1; outer_count++)
     {
       for (inner_count = outer_count + 1; inner_count < pg->total;
@@ -2230,10 +2416,13 @@ create_clique (struct GNUNET_TESTING_PeerGroup *pg,
                       "Connecting peer %d to peer %d\n",
                       outer_count, inner_count);
 #endif
-          connect_attempts += proc (pg, outer_count, inner_count, list);
+          connect_attempts += proc (pg, outer_count, inner_count, list, check);
+          update_meter(conn_meter);
         }
     }
-
+  GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Meter has %d left\n", conn_meter->total - conn_meter->completed);
+  reset_meter(conn_meter);
+  free_meter(conn_meter);
   return connect_attempts;
 }
 
@@ -2295,7 +2484,7 @@ copy_allowed (struct GNUNET_TESTING_PeerGroup *pg,
       iter = pg->peers[count].allowed_peers_head;
       while (iter != NULL)
         {
-          remove_connections(pg, count, iter->index, BLACKLIST);
+          remove_connections(pg, count, iter->index, BLACKLIST, GNUNET_YES);
           //unblacklist_connections(pg, count, iter->index);
           iter = iter->next;
         }
@@ -2307,6 +2496,7 @@ copy_allowed (struct GNUNET_TESTING_PeerGroup *pg,
   return total;
 }
 
+
 /**
  * Create a topology given a peer group (set of running peers)
  * and a connection processor.
@@ -2335,7 +2525,7 @@ create_line (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Connecting peer %d to peer %d\n", count, count + 1);
 #endif
-      connect_attempts += proc (pg, count, count + 1, list);
+      connect_attempts += proc (pg, count, count + 1, list, GNUNET_YES);
     }
 
   return connect_attempts;
@@ -2446,7 +2636,7 @@ create_from_file (struct GNUNET_TESTING_PeerGroup *pg,
               return connect_attempts;
             }
           /* Assume file is written with first peer 1, but array index is 0 */
-          connect_attempts += proc (pg, first_peer_index - 1, second_peer_index - 1, list);
+          connect_attempts += proc (pg, first_peer_index - 1, second_peer_index - 1, list, GNUNET_YES);
           while((buf[count] != '\n') && (buf[count] != ',') && (count < frstat.st_size - 1))
             count++;
           if (buf[count] == '\n')
@@ -2508,11 +2698,11 @@ create_ring (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Connecting peer %d to peer %d\n", count, count + 1);
 #endif
-      connect_attempts += proc (pg, count, count + 1, list);
+      connect_attempts += proc (pg, count, count + 1, list, GNUNET_YES);
     }
 
   /* Connect the last peer to the first peer */
-  connect_attempts += proc (pg, pg->total - 1, 0, list);
+  connect_attempts += proc (pg, pg->total - 1, 0, list, GNUNET_YES);
 
   return connect_attempts;
 }
@@ -3549,7 +3739,7 @@ copy_allowed_topology (struct GNUNET_TESTING_PeerGroup *pg)
       while (iter != NULL)
         {
           GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Creating connection between %d and %d\n", pg_iter, iter->index);
-          total += add_connections(pg, pg_iter, iter->index, CONNECT);
+          total += add_connections(pg, pg_iter, iter->index, CONNECT, GNUNET_NO);
           //total += add_actual_connections(pg, pg_iter, iter->index);
           iter = iter->next;
         }
@@ -3681,6 +3871,9 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
   unsigned int num_connections;
   int unblacklisted_connections;
   char *filename;
+  struct PeerConnection *conn_iter;
+  struct PeerConnection *temp_conn;
+  unsigned int off;
 
 #if !OLD
   unsigned int i;
@@ -3702,7 +3895,7 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
 #if VERBOSE_TESTING
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Creating clique topology\n"));
 #endif
-      num_connections = create_clique (pg, &add_connections, ALLOWED);
+      num_connections = create_clique (pg, &add_connections, ALLOWED, GNUNET_NO);
       break;
     case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING:
 #if VERBOSE_TESTING
@@ -3809,7 +4002,7 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
 
   /* Use the create clique method to initially set all connections as blacklisted. */
   if ((restrict_topology != GNUNET_TESTING_TOPOLOGY_NONE) && (restrict_topology != GNUNET_TESTING_TOPOLOGY_FROM_FILE))
-    create_clique (pg, &add_connections, BLACKLIST);
+    create_clique (pg, &add_connections, BLACKLIST, GNUNET_NO);
 
   unblacklisted_connections = 0;
   /* Un-blacklist connections as per the topology specified */
@@ -3821,7 +4014,7 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
                   _("Blacklisting all but clique topology\n"));
 #endif
       unblacklisted_connections =
-        create_clique (pg, &remove_connections, BLACKLIST);
+        create_clique (pg, &remove_connections, BLACKLIST, GNUNET_NO);
       break;
     case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING:
 #if VERBOSE_TESTING
@@ -3868,8 +4061,36 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   _("Blacklisting all but InterNAT topology\n"));
 #endif
-      unblacklisted_connections =
-        create_nated_internet (pg, &remove_connections, BLACKLIST);
+
+#if TOPOLOGY_HACK
+    for (off = 0; off < pg->total; off++)
+      {
+        conn_iter = pg->peers[off].allowed_peers_head;
+        while (conn_iter != NULL)
+          {
+            temp_conn = conn_iter->next;
+            GNUNET_free(conn_iter);
+            conn_iter = temp_conn;
+          }
+        pg->peers[off].allowed_peers_head = NULL;
+        pg->peers[off].allowed_peers_tail = NULL;
+
+        conn_iter = pg->peers[off].connect_peers_head;
+        while (conn_iter != NULL)
+          {
+            temp_conn = conn_iter->next;
+            GNUNET_free(conn_iter);
+            conn_iter = temp_conn;
+          }
+        pg->peers[off].connect_peers_head = NULL;
+        pg->peers[off].connect_peers_tail = NULL;
+      }
+    unblacklisted_connections = create_nated_internet_copy(pg, &remove_connections, BLACKLIST);
+#else
+    unblacklisted_connections =
+          create_nated_internet (pg, &remove_connections, BLACKLIST);
+#endif
+
       break;
     case GNUNET_TESTING_TOPOLOGY_SCALE_FREE:
 #if VERBOSE_TESTING
@@ -4111,7 +4332,7 @@ choose_random_connections (struct GNUNET_TESTING_PeerGroup *pg,
                                        UINT64_MAX)) / ((double) UINT64_MAX);
           if (random_number < percentage)
             {
-              add_connections(pg, pg_iter, conn_iter->index, WORKING_SET);
+              add_connections(pg, pg_iter, conn_iter->index, WORKING_SET, GNUNET_YES);
             }
           conn_iter = conn_iter->next;
         }
@@ -4134,7 +4355,7 @@ choose_random_connections (struct GNUNET_TESTING_PeerGroup *pg,
     {
       conn_iter = pg->peers[pg_iter].connect_peers_head;
       while (pg->peers[pg_iter].connect_peers_head != NULL)
-        remove_connections(pg, pg_iter, pg->peers[pg_iter].connect_peers_head->index, CONNECT);
+        remove_connections(pg, pg_iter, pg->peers[pg_iter].connect_peers_head->index, CONNECT, GNUNET_YES);
 
       pg->peers[pg_iter].connect_peers_head = pg->peers[pg_iter].connect_peers_working_set_head;
       pg->peers[pg_iter].connect_peers_tail = pg->peers[pg_iter].connect_peers_working_set_tail;
@@ -4267,7 +4488,7 @@ choose_minimum (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num)
             conn_iter = conn_iter->next;
           /* We now have a random connection, connect it! */
           GNUNET_assert(conn_iter != NULL);
-          add_connections(pg, pg_iter, conn_iter->index, WORKING_SET);
+          add_connections(pg, pg_iter, conn_iter->index, WORKING_SET, GNUNET_YES);
         }
     }
 #else
@@ -4306,7 +4527,7 @@ choose_minimum (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num)
   for (pg_iter = 0; pg_iter < pg->total; pg_iter++)
     {
       while (pg->peers[pg_iter].connect_peers_head != NULL)
-        remove_connections(pg, pg_iter, pg->peers[pg_iter].connect_peers_head->index, CONNECT);
+        remove_connections(pg, pg_iter, pg->peers[pg_iter].connect_peers_head->index, CONNECT, GNUNET_YES);
 
       pg->peers[pg_iter].connect_peers_head = pg->peers[pg_iter].connect_peers_working_set_head;
       pg->peers[pg_iter].connect_peers_tail = pg->peers[pg_iter].connect_peers_working_set_tail;
@@ -4482,8 +4703,8 @@ perform_dfs (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num)
           temp_count++;
         }
       GNUNET_assert(peer_iter != NULL);
-      add_connections(pg, starting_peer, peer_iter->index, WORKING_SET);
-      remove_connections(pg, starting_peer, peer_iter->index, CONNECT);
+      add_connections(pg, starting_peer, peer_iter->index, WORKING_SET, GNUNET_NO);
+      remove_connections(pg, starting_peer, peer_iter->index, CONNECT, GNUNET_YES);
       starting_peer = peer_iter->index;
       dfs_count++;
     }
@@ -4987,7 +5208,7 @@ GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg,
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   _("Creating clique CONNECT topology\n"));
 #endif
-      create_clique (pg, &add_connections, CONNECT);
+      create_clique (pg, &add_connections, CONNECT, GNUNET_NO);
       break;
     case GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING:
 #if VERBOSE_TOPOLOGY