+/**
+ * connect_mesh_service: connect to the mesh service of one of the peers
+ *
+ */
+static void
+connect_mesh_service (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ GNUNET_MESH_ApplicationType app;
+ unsigned int i;
+ struct GNUNET_PeerIdentity id;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "***************** test: connect_mesh_service\n");
+
+ for (i = 1; i <= num_peers; i++)
+ {
+ GNUNET_PEER_resolve (i, &id);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "***************** test: peer %s has %u conns to d1\n",
+ GNUNET_i2s (&id), mesh_peers[i]);
+ if (mesh_peers[i] == 0)
+ break;
+ }
+ GNUNET_assert (i < num_peers);
+ d2 = GNUNET_TESTING_daemon_get_by_id (pg, &id);
+ if (test == MULTICAST)
+ {
+ for (i++; i <= num_peers; i++)
+ {
+ GNUNET_PEER_resolve (i, &id);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "***************** test: peer %s has %u conns to d1\n",
+ GNUNET_i2s (&id), mesh_peers[i]);
+ if (mesh_peers[i] == 0)
+ break;
+ }
+ GNUNET_assert (i < num_peers);
+ d3 = GNUNET_TESTING_daemon_get_by_id (pg, &id);
+ }
+ app = (GNUNET_MESH_ApplicationType) 0;
+
+#if VERBOSE
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "***************** test: connecting to mesh service of peer %s (%u)\n",
+ GNUNET_i2s (&d1->id), mesh_peers[0]);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "***************** test: connecting to mesh service of peer %s (%u)\n",
+ GNUNET_i2s (&d2->id), i);
+ if (test == MULTICAST)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "***************** test: connecting to mesh service of peer %s (%u)\n",
+ GNUNET_i2s (&d3->id), i);
+ }
+#endif
+ h1 = GNUNET_MESH_connect (d1->cfg, 10, (void *) 1L, NULL, &tunnel_cleaner,
+ handlers, &app);
+ h2 = GNUNET_MESH_connect (d2->cfg, 10, (void *) 2L, &incoming_tunnel,
+ &tunnel_cleaner, handlers, &app);
+ if (test == MULTICAST)
+ {
+ h3 = GNUNET_MESH_connect (d3->cfg, 10, (void *) 3L, &incoming_tunnel,
+ &tunnel_cleaner, handlers, &app);
+ }
+ t = GNUNET_MESH_tunnel_create (h1, NULL, &ch, &dh, (void *) 1L);
+ peers_in_tunnel = 0;
+ test_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, 6), &do_test,
+ NULL);
+}