/**
 * Shutdown nicely
 *
 * @param cls NULL
 * @param tc the task context
 */
static void
do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  if (NULL != abort_task)
    GNUNET_SCHEDULER_cancel (abort_task);
  if (NULL != delay_task_id)
  {
    GNUNET_SCHEDULER_cancel (delay_task_id);
    delay_task_id = NULL;
  }
  if (NULL != hc_handle)
    GNUNET_TESTBED_is_host_habitable_cancel (hc_handle);
  if (NULL != mc)
    GNUNET_TESTBED_controller_disconnect (mc);
  if (NULL != cp)
    GNUNET_TESTBED_controller_stop (cp);
  if (NULL != slave3)
    GNUNET_TESTBED_host_destroy (slave3);
  if (NULL != slave2)
    GNUNET_TESTBED_host_destroy (slave2);
  if (NULL != slave)
    GNUNET_TESTBED_host_destroy (slave);
  if (NULL != host)
    GNUNET_TESTBED_host_destroy (host);
  if (NULL != cfg)
    GNUNET_CONFIGURATION_destroy (cfg);
  if (NULL != cfg3)
    GNUNET_CONFIGURATION_destroy (cfg3);
  if (NULL != rh)
    GNUNET_TESTBED_cancel_registration (rh);
}
/**
 * Shutdown nicely
 *
 * @param cls NULL
 * @param tc the task context
 */
static void
do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
    if (NULL != abort_task)
        GNUNET_SCHEDULER_cancel (abort_task);
    if (NULL != hc_handle)
        GNUNET_TESTBED_is_host_habitable_cancel (hc_handle);
    GNUNET_assert (NULL == delayed_connect_task);
    if (NULL != common_operation)
        GNUNET_TESTBED_operation_done (common_operation);
    if (NULL != reg_handle)
        GNUNET_TESTBED_cancel_registration (reg_handle);
    if (NULL != controller1)
        GNUNET_TESTBED_controller_disconnect (controller1);
    GNUNET_CONFIGURATION_destroy (cfg);
    if (NULL != cfg2)
        GNUNET_CONFIGURATION_destroy (cfg2);
    if (NULL != cp1)
        GNUNET_TESTBED_controller_stop (cp1);
    if (NULL != host)
        GNUNET_TESTBED_host_destroy (host);
    if (NULL != neighbour1)
        GNUNET_TESTBED_host_destroy (neighbour1);
    if (NULL != neighbour2)
        GNUNET_TESTBED_host_destroy (neighbour2);
}
Example #3
0
/**
 * Cancels operations and tasks which are assigned to the given run context
 *
 * @param rc the RunContext
 */
static void
rc_cleanup_operations (struct GNUNET_TESTBED_RunHandle *rc)
{
  struct CompatibilityCheckContext *hc;
  unsigned int nhost;

  if (NULL != rc->hclist)
  {
    for (nhost = 0; nhost < rc->num_hosts; nhost++)
    {
      hc = &rc->hclist[nhost];
      if (NULL != hc->h)
        GNUNET_TESTBED_is_host_habitable_cancel (hc->h);
    }
    GNUNET_free (rc->hclist);
    rc->hclist = NULL;
  }
  /* Stop register hosts task if it is running */
  if (NULL != rc->register_hosts_task)
  {
    GNUNET_SCHEDULER_cancel (rc->register_hosts_task);
    rc->register_hosts_task = NULL;
  }
  if (NULL != rc->timeout_task)
  {
    GNUNET_SCHEDULER_cancel (rc->timeout_task);
    rc->timeout_task = NULL;
  }
  if (NULL != rc->reg_handle)
  {
    GNUNET_TESTBED_cancel_registration (rc->reg_handle);
    rc->reg_handle = NULL;
  }
  if (NULL != rc->topology_operation)
  {
    GNUNET_TESTBED_operation_done (rc->topology_operation);
    rc->topology_operation = NULL;
  }
  /* cancel any exiting operations */
  GNUNET_assert (GNUNET_SYSERR !=
                 GNUNET_CONTAINER_multihashmap32_iterate (rc->rcop_map,
                                                          &rcop_cleanup_iterator,
                                                          rc));
}