aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-30 10:58:35 +0200
committerChristian Grothoff <christian@grothoff.org>2016-04-30 10:58:35 +0200
commit7fe7f66ffaed3fb98a4a8dffd9ae62f132ad69e3 (patch)
tree235962c86f25e619091047eb1b0af088533b7444
parent872d9056b53f0f3258d6bd4055466b494db9aba3 (diff)
update use to match new GNUnet scheduler API
-rw-r--r--src/exchange/taler-exchange-aggregator.c5
-rw-r--r--src/exchange/test_taler_exchange_aggregator.c31
2 files changed, 9 insertions, 27 deletions
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index 0cb47667f..57eab8138 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -966,9 +966,8 @@ run (void *cls,
}
task = GNUNET_SCHEDULER_add_now (&run_transfers,
NULL);
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &shutdown_task,
- cls);
+ GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+ cls);
}
diff --git a/src/exchange/test_taler_exchange_aggregator.c b/src/exchange/test_taler_exchange_aggregator.c
index e4ca89c77..7d1991754 100644
--- a/src/exchange/test_taler_exchange_aggregator.c
+++ b/src/exchange/test_taler_exchange_aggregator.c
@@ -194,11 +194,6 @@ static struct GNUNET_DISK_PipeHandle *sigpipe;
static struct GNUNET_SCHEDULER_Task *child_death_task;
/**
- * ID of task called whenever are shutting down.
- */
-static struct GNUNET_SCHEDULER_Task *shutdown_task;
-
-/**
* Return value from main().
*/
static int result;
@@ -267,7 +262,6 @@ interpreter (void *cls);
static void
shutdown_action (void *cls)
{
- shutdown_task = NULL;
if (NULL != int_task)
{
GNUNET_SCHEDULER_cancel (int_task);
@@ -278,15 +272,18 @@ shutdown_action (void *cls)
FAKEBANK_stop (fb);
fb = NULL;
}
- if (NULL == aggregator_proc)
+ if (NULL != child_death_task)
{
GNUNET_SCHEDULER_cancel (child_death_task);
child_death_task = NULL;
}
- else
+ if (NULL != aggregator_proc)
{
GNUNET_break (0 == GNUNET_OS_process_kill (aggregator_proc,
SIGKILL));
+ GNUNET_OS_process_wait (aggregator_proc);
+ GNUNET_OS_process_destroy (aggregator_proc);
+ aggregator_proc = NULL;
}
plugin->drop_temporary (plugin->cls,
session);
@@ -312,16 +309,6 @@ maint_child_death (void *cls)
child_death_task = NULL;
pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
tc = GNUNET_SCHEDULER_get_task_context ();
- if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
- {
- /* shutdown scheduled us, ignore! */
- child_death_task =
- GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- pr,
- &maint_child_death,
- NULL);
- return;
- }
GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c)));
GNUNET_OS_process_wait (aggregator_proc);
GNUNET_OS_process_destroy (aggregator_proc);
@@ -330,8 +317,6 @@ maint_child_death (void *cls)
state = aggregator_state;
aggregator_state = NULL;
interpreter (state);
- if (NULL == shutdown_task)
- return;
child_death_task = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
pr,
&maint_child_death, NULL);
@@ -1160,10 +1145,8 @@ run (void *cls)
GNUNET_DISK_pipe_handle (sigpipe,
GNUNET_DISK_PIPE_END_READ),
&maint_child_death, NULL);
- shutdown_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &shutdown_action,
- NULL);
+ GNUNET_SCHEDULER_add_shutdown (&shutdown_action,
+ NULL);
result = 1; /* test failed for undefined reason */
fb = FAKEBANK_start (8082);
if (NULL == fb)