int dna_helper_shutdown()
{
  if (config.debug.dnahelper)
    DEBUG("DNAHELPER shutting down");
  dna_helper_close_pipes();
  switch (dna_helper_kill()) {
  case -1:
    return -1;
  case 0:
    return 0;
  default:
    return dna_helper_harvest(1);
  }
}
Beispiel #2
0
static void harvester(struct sched_ent *alarm)
{
  // While the helper process appears to still be running, keep calling this function.
  // Otherwise, wait a while before re-starting the helper.
  if (dna_helper_harvest(0) <= 0) {
    sched_harvester.alarm = gettime_ms() + 1000;
    sched_harvester.deadline = sched_harvester.alarm + 1000;
    schedule(&sched_harvester);
  } else {
    const int delay_ms = 500;
    if (debug & DEBUG_DNAHELPER)
      DEBUGF("DNAHELPER process died, pausing %d ms before restart", delay_ms);
    dna_helper_pid = 0; // Will be set to -1 after delay
    sched_restart.function = restart_delayer;
    sched_restart.alarm = gettime_ms() + delay_ms;
    sched_restart.deadline = sched_restart.alarm + 500;
    schedule(&sched_restart);
  }
}