summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-06-26 16:10:49 +0200
committerChristian Grothoff <christian@grothoff.org>2022-06-26 16:10:49 +0200
commitccd79e68c6dd55b1c4b09a0f6abb3783f346ddcc (patch)
tree87f0c78f9aba1b09b0fafb1fdfc68785515fdcda
parentbeb45b17933cbc371f5bc8bd08589b4f22bf316e (diff)
downloadanastasis-ccd79e68c6dd55b1c4b09a0f6abb3783f346ddcc.tar.gz
anastasis-ccd79e68c6dd55b1c4b09a0f6abb3783f346ddcc.tar.bz2
anastasis-ccd79e68c6dd55b1c4b09a0f6abb3783f346ddcc.zip
fix #7227: use short timeout
-rw-r--r--src/cli/Makefile.am1
-rwxr-xr-xsrc/cli/test_anastasis_reducer_recovery_hanging.sh4
-rw-r--r--src/reducer/anastasis_api_redux.c20
3 files changed, 18 insertions, 7 deletions
diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index dccd9af..44cad27 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -21,6 +21,7 @@ check_SCRIPTS = \
test_anastasis_reducer_enter_secret.sh \
test_anastasis_reducer_recovery_enter_user_attributes.sh \
test_anastasis_reducer_recovery_no_pay.sh \
+ test_anastasis_reducer_recovery_hanging.sh \
test_iban.sh
diff --git a/src/cli/test_anastasis_reducer_recovery_hanging.sh b/src/cli/test_anastasis_reducer_recovery_hanging.sh
index dba9ee4..f67b850 100755
--- a/src/cli/test_anastasis_reducer_recovery_hanging.sh
+++ b/src/cli/test_anastasis_reducer_recovery_hanging.sh
@@ -3,7 +3,7 @@
# Runs tests with a 'hanging' Anastasis provider.
set -eu
-set -x
+#set -x
# Exit, with status code "skip" (no 'real' failure)
function exit_skip() {
@@ -22,6 +22,7 @@ function cleanup()
{
for n in `jobs -p`
do
+ kill -SIGCONT $n # in case suspended...
kill $n 2> /dev/null || true
done
rm -rf $CONF $R1FILE $R2FILE $B1FILE $B2FILE $TMP_DIR
@@ -190,7 +191,6 @@ kill -SIGCONT $PPID_4
if test $DELTA -ge 5
then
- bash
exit_fail "Reducer hangs on suspended provider in 'enter_user_attributes'"
fi
diff --git a/src/reducer/anastasis_api_redux.c b/src/reducer/anastasis_api_redux.c
index 1c770f1..8090e00 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -1,6 +1,6 @@
/*
This file is part of Anastasis
- Copyright (C) 2020, 2021 Anastasis SARL
+ Copyright (C) 2020, 2021, 2022 Anastasis SARL
Anastasis is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -36,6 +36,12 @@
*/
#define CONFIG_GENERIC_TIMEOUT GNUNET_TIME_UNIT_MINUTES
+/**
+ * How long do we wait in a more "synchronous"
+ * scenaro for a /config reply from an Anastasis provider.
+ */
+#define CONFIG_FAST_TIMEOUT GNUNET_TIME_UNIT_SECONDS
+
#define GENERATE_STRING(STRING) #STRING,
static const char *generic_strings[] = {
@@ -651,11 +657,13 @@ config_request_timeout (void *cls)
/**
* Schedule job to obtain Anastasis provider configuration at @a url.
*
+ * @param timeout how long to wait for a reply
* @param url base URL of Anastasis provider
* @return check config handle
*/
static struct ConfigRequest *
-check_config (const char *url)
+check_config (struct GNUNET_TIME_Relative timeout,
+ const char *url)
{
struct ConfigRequest *cr;
@@ -687,7 +695,7 @@ check_config (const char *url)
GNUNET_break (0);
return NULL;
}
- cr->tt = GNUNET_SCHEDULER_add_delayed (CONFIG_GENERIC_TIMEOUT,
+ cr->tt = GNUNET_SCHEDULER_add_delayed (timeout,
&config_request_timeout,
cr);
return cr;
@@ -795,7 +803,8 @@ begin_provider_config_check (const char *cc,
json_object_set_new (pl,
url,
prov));
- check_config (url);
+ check_config (CONFIG_GENERIC_TIMEOUT,
+ url);
}
GNUNET_assert (0 ==
json_object_set_new (state,
@@ -1159,7 +1168,8 @@ ANASTASIS_REDUX_add_provider_to_state_ (const char *url,
struct ConfigRequest *cr;
struct ConfigReduxWaiting *w;
- cr = check_config (url);
+ cr = check_config (CONFIG_FAST_TIMEOUT,
+ url);
w = GNUNET_new (struct ConfigReduxWaiting);
w->cr = cr;
w->state = json_incref (state);