static void
do_shutdown ()
{
  fprintf (stderr, "Shutdown\n");
  /* timeout */
  if (NULL != l)
  {
    GNUNET_ATS_TEST_logging_stop (l);
    GNUNET_ATS_TEST_logging_clean_up (l);
    l = NULL;
  }

  /* Stop traffic generation */
  GNUNET_ATS_TEST_generate_traffic_stop_all();

  /* Stop all preference generations */
  GNUNET_ATS_TEST_generate_preferences_stop_all ();

  if (NULL != e)
  {
    GNUNET_ATS_TEST_experimentation_stop (e);
    e = NULL;
  }
  GNUNET_ATS_TEST_shutdown_topology ();
}
static void
experiment_done_cb (struct Experiment *e, struct GNUNET_TIME_Relative duration,int success)
{
  if (GNUNET_OK == success)
    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment done successful in %s\n",
        GNUNET_STRINGS_relative_time_to_string (duration, GNUNET_YES));
  else
    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment failed \n");
  if (GNUNET_SCHEDULER_NO_TASK != timeout_task)
  {
    GNUNET_SCHEDULER_cancel (timeout_task);
    timeout_task = GNUNET_SCHEDULER_NO_TASK;
  }
  /* Stop logging */
  GNUNET_ATS_TEST_logging_stop (l);

  /* Stop traffic generation */
  GNUNET_ATS_TEST_generate_traffic_stop_all();

  /* Stop all preference generations */
  GNUNET_ATS_TEST_generate_preferences_stop_all ();

  evaluate (duration);
  if (opt_log)
    GNUNET_ATS_TEST_logging_write_to_file(l, opt_exp_file, opt_plot);

  if (NULL != l)
  {
    GNUNET_ATS_TEST_logging_stop (l);
    GNUNET_ATS_TEST_logging_clean_up (l);
    l = NULL;
  }

  /* Clean up experiment */
  GNUNET_ATS_TEST_experimentation_stop (e);
  e = NULL;

  /* Shutdown topology */
  GNUNET_ATS_TEST_shutdown_topology ();
}
Beispiel #3
0
/**
 * Clean up logging data
 *
 * @param l the logging handle
 */
void
GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l)
{
  int c_m;
  struct PeerLoggingTimestep *cur;

  if (GNUNET_YES == l->running)
    GNUNET_ATS_TEST_logging_stop (l);

  for (c_m = 0; c_m < l->num_masters; c_m++)
  {
    while (NULL != (cur = l->lp[c_m].head))
    {
      GNUNET_CONTAINER_DLL_remove (l->lp[c_m].head, l->lp[c_m].tail, cur);
      GNUNET_free (cur->slaves_log);
      GNUNET_free (cur);
    }
  }

  GNUNET_free (l->lp);
  GNUNET_free (l);
}