integrate child_death_task with aggregator struct, and cancel it on error

This commit is contained in:
Christian Grothoff 2016-06-09 15:20:24 +02:00
parent e1b2900ebe
commit 421b4f403f

View File

@ -585,6 +585,11 @@ struct Command
*/
struct GNUNET_OS_Process *aggregator_proc;
/**
* ID of task called whenever we get a SIGCHILD.
*/
struct GNUNET_SCHEDULER_Task *child_death_task;
} run_aggregator;
struct {
@ -681,12 +686,6 @@ struct InterpreterState
*/
static struct GNUNET_DISK_PipeHandle *sigpipe;
/**
* ID of task called whenever we get a SIGCHILD.
*/
static struct GNUNET_SCHEDULER_Task *child_death_task;
/**
* The testcase failed, return with an error code.
@ -1266,7 +1265,7 @@ maint_child_death (void *cls)
const struct GNUNET_DISK_FileHandle *pr;
char c[16];
child_death_task = NULL;
cmd->details.run_aggregator.child_death_task = NULL;
pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c)));
GNUNET_OS_process_wait (cmd->details.run_aggregator.aggregator_proc);
@ -2233,9 +2232,10 @@ interpreter_run (void *cls)
return;
}
pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
child_death_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
pr,
&maint_child_death, is);
cmd->details.run_aggregator.child_death_task
= GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
pr,
&maint_child_death, is);
return;
}
case OC_CHECK_BANK_TRANSFER:
@ -2547,6 +2547,11 @@ do_shutdown (void *cls)
GNUNET_OS_process_destroy (cmd->details.run_aggregator.aggregator_proc);
cmd->details.run_aggregator.aggregator_proc = NULL;
}
if (NULL != cmd->details.run_aggregator.child_death_task)
{
GNUNET_SCHEDULER_cancel (cmd->details.run_aggregator.child_death_task);
cmd->details.run_aggregator.child_death_task = NULL;
}
break;
case OC_CHECK_BANK_TRANSFER:
break;