[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis-gtk] branch master updated: show exact timeout frequenc
From: |
gnunet |
Subject: |
[taler-anastasis-gtk] branch master updated: show exact timeout frequency issue (#7054) |
Date: |
Fri, 31 Dec 2021 11:47:09 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis-gtk.
The following commit(s) were added to refs/heads/master by this push:
new c76ed19 show exact timeout frequency issue (#7054)
c76ed19 is described below
commit c76ed196f2bfe4077e15d69dd06857d60b409e0d
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Dec 31 11:47:06 2021 +0100
show exact timeout frequency issue (#7054)
---
src/anastasis/anastasis-gtk_action.c | 53 ++++++++++++++++++++++++++++++------
1 file changed, 45 insertions(+), 8 deletions(-)
diff --git a/src/anastasis/anastasis-gtk_action.c
b/src/anastasis/anastasis-gtk_action.c
index 8ad386f..df6edb0 100644
--- a/src/anastasis/anastasis-gtk_action.c
+++ b/src/anastasis/anastasis-gtk_action.c
@@ -1671,10 +1671,12 @@ find_challenge_by_uuid (const char *uuid)
* Translate the @a state into a localized, human-readable
* string.
*
+ * @param f full json state about the state
* @param state a challenge state, as a string
*/
-static const char *
-translate_state (const char *state)
+static char *
+translate_state (const json_t *f,
+ const char *state)
{
struct
{
@@ -1698,8 +1700,6 @@ translate_state (const char *state)
{ .in = "truth-unknown",
.out = _ ("fatal: challenge unknown to provider; "
"maybe you can solve another policy?") },
- { .in = "rate-limit-exceeded",
- .out = _ ("wait, tries exceeded at this time") },
{ .in = "authentication-timeout",
.out = _ ("awaiting completion of authentication process") },
{ .in = "external-instructions",
@@ -1708,17 +1708,52 @@ translate_state (const char *state)
.out = NULL }
};
+ if (0 == strcmp (state,
+ "rate-limit-exceeded"))
+ {
+ uint32_t request_limit;
+ struct GNUNET_TIME_Relative rf;
+ struct GNUNET_JSON_Specification spec[] = {
+ GNUNET_JSON_spec_uint32 ("request_limit",
+ &request_limit),
+ GNUNET_JSON_spec_relative_time ("request_frequency",
+ &rf),
+ GNUNET_JSON_spec_end ()
+ };
+ char *reply;
+
+ if (GNUNET_OK !=
+ GNUNET_JSON_parse (f,
+ spec,
+ NULL, NULL))
+ {
+ GNUNET_break (0);
+ json_dumpf (f,
+ stderr,
+ JSON_INDENT (2));
+ return GNUNET_strdup (
+ _ ("wait, tries exceeded at this time"));
+
+ }
+ GNUNET_asprintf (&reply,
+ _ ("exceeded limit of %u attempts in %s"),
+ (unsigned int) request_limit,
+ GNUNET_TIME_relative2s (rf,
+ true));
+ return reply;
+ }
+
for (unsigned int i = 0; NULL != state_map[i].in; i++)
{
if (0 != strcmp (state_map[i].in,
state))
continue;
- return state_map[i].out;
+ return GNUNET_strdup (state_map[i].out);
}
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Could not localize unexpected state `%s'\n",
state);
- return state;
+ return GNUNET_strdup (state);
}
@@ -1826,15 +1861,17 @@ show_challenge_feedback (const char *uuid,
}
else
{
- const char *hint;
+ char *hint;
GtkLabel *l;
- hint = translate_state (state);
+ hint = translate_state (f,
+ state);
l = GTK_LABEL (gtk_builder_get_object (builder,
"hint_label"));
gtk_label_set_text (l,
hint);
gtk_widget_show (GTK_WIDGET (l));
+ GNUNET_free (hint);
}
if (0 == strcmp (state,
"details"))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis-gtk] branch master updated: show exact timeout frequency issue (#7054),
gnunet <=