summaryrefslogtreecommitdiff
path: root/src/bank-lib
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-05-02 06:48:25 +0200
committerChristian Grothoff <christian@grothoff.org>2016-05-02 06:48:25 +0200
commitad45e5ab7a679e493d6c28910b2d01b73e0d7e57 (patch)
treea587c4e5e928f86cbadd4567fb19f0f55c0138fe /src/bank-lib
parent1cbba4bec1551a4662029e2899e5120cc4793c4b (diff)
downloadexchange-ad45e5ab7a679e493d6c28910b2d01b73e0d7e57.tar.gz
exchange-ad45e5ab7a679e493d6c28910b2d01b73e0d7e57.tar.bz2
exchange-ad45e5ab7a679e493d6c28910b2d01b73e0d7e57.zip
adjust shutdown/timeout to match latest GNUnet scheduler API semantics
Diffstat (limited to 'src/bank-lib')
-rw-r--r--src/bank-lib/test_bank_api.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/bank-lib/test_bank_api.c b/src/bank-lib/test_bank_api.c
index 019b0997..b92cf5a5 100644
--- a/src/bank-lib/test_bank_api.c
+++ b/src/bank-lib/test_bank_api.c
@@ -33,9 +33,9 @@
static struct GNUNET_CURL_Context *ctx;
/**
- * Task run on shutdown.
+ * Task run on timeout.
*/
-static struct GNUNET_SCHEDULER_Task *shutdown_task;
+static struct GNUNET_SCHEDULER_Task *timeout_task;
/**
* Task that runs the main event loop.
@@ -349,6 +349,19 @@ interpreter_run (void *cls)
/**
+ * Function run on timeout.
+ *
+ * @param cls NULL
+ */
+static void
+do_timeout (void *cls)
+{
+ timeout_task = NULL;
+ GNUNET_SCHEDULER_shutdown ();
+}
+
+
+/**
* Function run when the test terminates (good or bad).
* Cleans up our state.
*
@@ -361,7 +374,12 @@ do_shutdown (void *cls)
struct Command *cmd;
unsigned int i;
- shutdown_task = NULL;
+ if (NULL != timeout_task)
+ {
+ GNUNET_SCHEDULER_cancel (timeout_task);
+ timeout_task = NULL;
+ }
+
for (i=0;OC_END != (cmd = &is->commands[i])->oc;i++)
{
switch (cmd->oc)
@@ -494,10 +512,11 @@ run (void *cls)
ctx);
is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
is);
- shutdown_task
+ timeout_task
= GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 150),
- &do_shutdown, is);
+ &do_timeout, is);
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown, is);
}