Esempio n. 1
0
/**
 * Task run during shutdown.
 *
 * @param cls unused
 * @param tc unused
 */
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  struct Ego *e;

  if (NULL != nc)
  {
    GNUNET_SERVER_notification_context_destroy (nc);
    nc = NULL;
  }
  if (NULL != stats)
  {
    GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
    stats = NULL;
  }
  GNUNET_CONFIGURATION_destroy (subsystem_cfg);
  subsystem_cfg = NULL;
  GNUNET_free (subsystem_cfg_file);
  subsystem_cfg_file = NULL;
  GNUNET_free (ego_directory);
  ego_directory = NULL;
  while (NULL != (e = ego_head))
  {
    GNUNET_CONTAINER_DLL_remove (ego_head, ego_tail, e);
    GNUNET_free (e->pk);
    GNUNET_free (e->identifier);
    GNUNET_free (e);
  }
}
/**
 * Stop processing clients.
 */
void
GST_clients_stop ()
{
  struct AddressToStringContext *cur;

  while (NULL != (cur = a2s_head))
  {
    GNUNET_SERVER_transmit_context_destroy (cur->tc, GNUNET_NO);
    GNUNET_CONTAINER_DLL_remove (a2s_head, a2s_tail, cur);
    GNUNET_free (cur);
  }
  if (NULL != peer_nc)
  {
    GNUNET_SERVER_notification_context_destroy (peer_nc);
    peer_nc = NULL;
  }
  if (NULL != val_nc)
  {
    GNUNET_SERVER_notification_context_destroy (val_nc);
    val_nc = NULL;
  }
}
/**
 * Clean up our state.  Called during shutdown.
 *
 * @param cls unused
 * @param tc scheduler task context, unused
 */
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  GNUNET_SERVER_notification_context_destroy (notify_list);
  notify_list = NULL;
  GNUNET_CONTAINER_multihashmap_iterate (hostmap, &free_host_entry, NULL);
  GNUNET_CONTAINER_multihashmap_destroy (hostmap);
  if (stats != NULL)
  {
    GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
    stats = NULL;
  }
}
/**
 * Task run during shutdown.
 *
 * @param cls unused
 * @param tc unused
 */
static void
shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{

  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
             "Shutting down!");
  /* Kill zone task for it may make the scheduler hang */
  if (zone_update_taskid != GNUNET_SCHEDULER_NO_TASK)
    GNUNET_SCHEDULER_cancel(zone_update_taskid);
  
  GNUNET_SERVER_notification_context_destroy (nc);
  
  gns_interceptor_stop();
  gns_resolver_cleanup(&on_resolver_cleanup);

}
Esempio n. 5
0
/**
 * Task run during shutdown.
 *
 * @param cls unused
 */
static void
cleanup_task (void *cls)
{
  struct ClientEntry *ce;

  while (NULL != (ce = client_head))
    handle_client_disconnect (NULL,
                              ce->client);
  GNUNET_DHT_disconnect (dht);
  dht = NULL;
  GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
  stats = NULL;
  GNUNET_SERVER_notification_context_destroy (nc);
  nc = NULL;
  GNUNET_free (my_private_key);
  my_private_key = NULL;
}