/**
 * Shutdown nicely
 *
 * @param cls
 * @param tc the task context
 */
static void
do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  if (GNUNET_SCHEDULER_NO_TASK != abort_task_id)
  {
    GNUNET_SCHEDULER_cancel (abort_task_id);
    abort_task_id = GNUNET_SCHEDULER_NO_TASK;
  }
  if (NULL != handle)
    GNUNET_LOCKMANAGER_disconnect (handle);
  if (NULL != handle2)
    GNUNET_LOCKMANAGER_disconnect (handle2);
}
/**
 * Shutdown nicely
 *
 * @param cls
 * @param tc the task context
 */
static void
do_shutdown (void *cls, const const struct GNUNET_SCHEDULER_TaskContext *tc)
{
  if (GNUNET_SCHEDULER_NO_TASK != abort_task_id)
    {
      GNUNET_SCHEDULER_cancel (abort_task_id);
      abort_task_id = GNUNET_SCHEDULER_NO_TASK;
    }
  if (NULL != request)
    GNUNET_LOCKMANAGER_cancel_request (request);
  if (NULL != request2)
    GNUNET_LOCKMANAGER_cancel_request (request2);
  GNUNET_LOCKMANAGER_disconnect (handle);
  if (0 != GNUNET_OS_process_kill (arm_pid, SIGTERM))
    {
      LOG (GNUNET_ERROR_TYPE_DEBUG,
           "Kill gnunet-service-arm manually\n");
    }
  GNUNET_OS_process_wait (arm_pid);
  GNUNET_OS_process_destroy (arm_pid);

  if (NULL != config)
    GNUNET_CONFIGURATION_destroy (config);
}