- if (emsg != NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Peergroup callback called with error, aborting test!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Error from testing: `%s'\n",
- emsg);
- ok++;
- GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
- return;
- }
-#if VERBOSE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "************************************************************\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "test: Peer Group started successfully!\n");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Have %u connections\n",
- total_connections);
-#endif
-
- if (data_file != NULL)
- {
- buf = NULL;
- buf_len = GNUNET_asprintf (&buf, "CONNECTIONS_0: %u\n", total_connections);
- if (buf_len > 0)
- GNUNET_DISK_file_write (data_file, buf, buf_len);
- GNUNET_free (buf);
- }
- peers_running = GNUNET_TESTING_daemons_running (pg);
-
- GNUNET_assert (peers_running == num_peers);
- hs = GNUNET_malloc (num_peers * sizeof (struct GNUNET_DHT_Handle *));
- mhs = GNUNET_malloc (num_peers * sizeof (struct GNUNET_DHT_MonitorHandle *));
- d_far = o = NULL;
- for (i = 0; i < num_peers; i++)
- {
- d = GNUNET_TESTING_daemon_get (pg, i);
- hs[i] = GNUNET_DHT_connect (d->cfg, 32);
- mhs[i] = GNUNET_DHT_monitor_start(hs[i], GNUNET_BLOCK_TYPE_ANY, NULL,
- &monitor_dht_cb, (void *)(long)i);
- id_aux = GNUNET_i2s (&d->id);
- if (strcmp (id_aux, id_origin) == 0)
- {
- o = d;
- i_origin = i;
- }
- if (strcmp (id_aux, id_far) == 0)
- {
- i_far = i;
- d_far = d;
- }
- }
-
- if ((NULL == o) || (NULL == d_far))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "test: Peers not found (hostkey file changed?)\n");
- GNUNET_SCHEDULER_cancel (disconnect_task);
- disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
- return;
- }
- monitor_counter = 0;
- put_task = GNUNET_SCHEDULER_add_now (&put_id, NULL);
- test_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 2), &do_test,
- NULL);
- disconnect_task =
- GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &disconnect_peers, NULL);
-