[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: fix async issue
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: fix async issue |
Date: |
Wed, 03 Mar 2021 11:13:36 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new 66ffbf3 fix async issue
66ffbf3 is described below
commit 66ffbf36bc43313c326f2afa0811db98c88112c2
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Mar 3 11:13:33 2021 +0100
fix async issue
---
src/lib/anastasis_recovery.c | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/src/lib/anastasis_recovery.c b/src/lib/anastasis_recovery.c
index 97d5324..d90c24f 100644
--- a/src/lib/anastasis_recovery.c
+++ b/src/lib/anastasis_recovery.c
@@ -198,6 +198,11 @@ struct ANASTASIS_Recovery
*/
char *provider_url;
+ /**
+ * Task to run @e pc asynchronously.
+ */
+ struct GNUNET_SCHEDULER_Task *do_async;
+
/**
* Retrieved encrypted core secret from policy
*/
@@ -1146,6 +1151,22 @@ parse_dps_array (struct ANASTASIS_Recovery *r,
}
+/**
+ * Asynchronously call "pc" on the recovery information.
+ *
+ * @param cls a `struct ANASTASIS_Recovery *`
+ */
+static void
+run_async_pc (void *cls)
+{
+ struct ANASTASIS_Recovery *r = cls;
+
+ r->do_async = NULL;
+ r->pc (r->pc_cls,
+ &r->ri);
+}
+
+
struct ANASTASIS_Recovery *
ANASTASIS_recovery_deserialize (struct GNUNET_CURL_Context *ctx,
const json_t *input,
@@ -1259,9 +1280,8 @@ ANASTASIS_recovery_deserialize (struct
GNUNET_CURL_Context *ctx,
}
else
{
- /* FIXME: maybe better do this asynchronously in a new task? */
- r->pc (r->pc_cls,
- &r->ri);
+ r->do_async = GNUNET_SCHEDULER_add_now (&run_async_pc,
+ r);
}
return r;
}
@@ -1270,6 +1290,11 @@ ANASTASIS_recovery_deserialize (struct
GNUNET_CURL_Context *ctx,
void
ANASTASIS_recovery_abort (struct ANASTASIS_Recovery *r)
{
+ if (NULL != r->do_async)
+ {
+ GNUNET_SCHEDULER_cancel (r->do_async);
+ r->do_async = NULL;
+ }
if (NULL != r->plo)
{
ANASTASIS_policy_lookup_cancel (r->plo);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: fix async issue,
gnunet <=