Esempio n. 1
0
/**
 * Task run during shutdown.
 *
 * @param cls unused
 */
static void
shutdown_task (void *cls)
{
  if (NULL != flood_task)
  {
    GNUNET_SCHEDULER_cancel (flood_task);
    flood_task = NULL;
  }
  if (NULL != proof_task)
  {
    GNUNET_SCHEDULER_cancel (proof_task);
    proof_task = NULL;
    write_proof ();             /* remember progress */
  }
  if (NULL != nc)
  {
    GNUNET_notification_context_destroy (nc);
    nc = NULL;
  }
  if (NULL != core_api)
  {
    GNUNET_CORE_disconnect (core_api);
    core_api = NULL;
  }
  if (NULL != stats)
  {
    GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
    stats = NULL;
  }
  if (NULL != peers)
  {
    GNUNET_CONTAINER_multipeermap_destroy (peers);
    peers = NULL;
  }
  if (NULL != my_private_key)
  {
    GNUNET_free (my_private_key);
    my_private_key = NULL;
  }
#if ENABLE_NSE_HISTOGRAM
  if (NULL != logger_test)
  {
    GNUNET_CLIENT_service_test_cancel (logger_test);
    logger_test = NULL;
  }
  if (NULL != lh)
  {
    GNUNET_TESTBED_LOGGER_flush (lh,
                                 &flush_comp_cb,
                                 NULL);
  }
  if (NULL != histogram)
  {
    GNUNET_BIO_write_close (histogram);
    histogram = NULL;
  }
#endif
}
Esempio n. 2
0
/**
 * Task that reports back the result by calling the callback
 * and then cleans up.
 *
 * @param cls the `struct GNUNET_CLIENT_TestHandle`
 * @param tc scheduler context
 */
static void
report_result (void *cls,
	       const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  struct GNUNET_CLIENT_TestHandle *th = cls;

  th->task = NULL;
  th->cb (th->cb_cls, th->result);
  GNUNET_CLIENT_service_test_cancel (th);
}