[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: transition to new semi-successf
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: transition to new semi-successful state if policy download failed |
Date: |
Sun, 21 Mar 2021 15:46:24 +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 27b1b51 transition to new semi-successful state if policy download
failed
27b1b51 is described below
commit 27b1b5126083b3b87880f37b3ae398f94a3fadae
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Sun Mar 21 15:46:12 2021 +0100
transition to new semi-successful state if policy download failed
---
src/reducer/anastasis_api_recovery_redux.c | 75 +++++++++++++++++++++---------
1 file changed, 54 insertions(+), 21 deletions(-)
diff --git a/src/reducer/anastasis_api_recovery_redux.c
b/src/reducer/anastasis_api_recovery_redux.c
index 9519fea..6c0147f 100644
--- a/src/reducer/anastasis_api_recovery_redux.c
+++ b/src/reducer/anastasis_api_recovery_redux.c
@@ -1910,6 +1910,47 @@ lookup_cost (const json_t *state,
}
+/**
+ * We failed to download a policy. Show an error to the user and
+ * allow the user to specify alternative providers and/or policy
+ * versions.
+ *
+ * @param[in] rss state to fail with the policy download
+ * @param offline true of the reason to show is that all providers
+ * were offline / did not return a salt to us
+ */
+static void
+return_no_policy (struct RecoverSecretState *rss,
+ bool offline)
+{
+ json_t *msg;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "No provider online, need user to manually specfy providers!\n");
+ msg = json_pack ("{s:s, s:b}",
+ "hint",
+ offline ? "could not contact provider" :
+ "provider does not know you",
+ "offline",
+ offline);
+ GNUNET_assert (0 ==
+ json_object_set_new (rss->state,
+ "recovery_error",
+ msg));
+ /* In case there are old ones, remove them! */
+ (void) json_object_del (rss->state,
+ "recovery_document");
+ (void) json_object_del (rss->state,
+ "recovery_information");
+ set_state (rss->state,
+ ANASTASIS_RECOVERY_STATE_CHALLENGE_SELECTING);
+ rss->cb (rss->cb_cls,
+ TALER_EC_NONE,
+ rss->state);
+ free_rss (rss);
+}
+
+
/**
* Callback which passes back the recovery document and its possible
* policies. Also passes back the version of the document for the user
@@ -1944,12 +1985,8 @@ policy_lookup_cb (void *cls,
if (NULL != rss->pd_head)
return; /* wait for another one */
/* all failed! report failure! */
- set_state (rss->state,
- ANASTASIS_GENERIC_STATE_ERROR);
- rss->cb (rss->cb_cls,
- TALER_EC_ANASTASIS_REDUCER_POLICY_LOOKUP_FAILED,
- rss->state);
- free_rss (rss);
+ return_no_policy (rss,
+ false);
return;
}
policies = json_array ();
@@ -2056,6 +2093,9 @@ policy_lookup_cb (void *cls,
"recovery_document",
rd));
}
+ /* In case there is an old error remove it! */
+ (void) json_object_del (rss->state,
+ "recovery_error");
set_state (rss->state,
ANASTASIS_RECOVERY_STATE_CHALLENGE_SELECTING);
rss->cb (rss->cb_cls,
@@ -2139,14 +2179,10 @@ providers_complete (struct RecoverSecretState *rss)
spec,
NULL, NULL))
{
- GNUNET_break_op (0);
- ANASTASIS_redux_fail_ (rss->cb,
- rss->cb_cls,
- TALER_EC_ANASTASIS_REDUCER_STATE_INVALID,
- "could not begin parse
'authentication_provider' data");
- rss->cb = NULL;
- free_rss (rss);
- return;
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "No salt for `%s', provider offline?\n",
+ provider_url);
+ continue;
}
pd->rss = rss;
pd->recovery = ANASTASIS_recovery_begin (ANASTASIS_REDUX_ctx_,
@@ -2166,13 +2202,10 @@ providers_complete (struct RecoverSecretState *rss)
}
if (! launched)
{
- GNUNET_break (0);
- ANASTASIS_redux_fail_ (rss->cb,
- rss->cb_cls,
- TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
- "Failed to begin recovery operation");
- rss->cb = NULL;
- free_rss (rss);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "No provider online, need user to manually specfy
providers!\n");
+ return_no_policy (rss,
+ true);
return;
}
}
--
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: transition to new semi-successful state if policy download failed,
gnunet <=