diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-09 15:20:24 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-09 15:20:24 +0200 |
commit | 421b4f403f182cbd8e7ee6faa63fba6f2c412ae7 (patch) | |
tree | fc5979a1142d57fc403578fd3dab42df7af583b2 /src/exchange-lib/test_exchange_api.c | |
parent | e1b2900ebe2b82a627fbc272800716896af6d793 (diff) |
integrate child_death_task with aggregator struct, and cancel it on error
Diffstat (limited to 'src/exchange-lib/test_exchange_api.c')
-rw-r--r-- | src/exchange-lib/test_exchange_api.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c index 102c37b08..34e9da83b 100644 --- a/src/exchange-lib/test_exchange_api.c +++ b/src/exchange-lib/test_exchange_api.c @@ -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; |