From ccd79e68c6dd55b1c4b09a0f6abb3783f346ddcc Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 26 Jun 2022 16:10:49 +0200 Subject: fix #7227: use short timeout --- src/reducer/anastasis_api_redux.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/reducer/anastasis_api_redux.c') 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); -- cgit v1.2.3