diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-04-13 09:15:39 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-04-13 09:15:39 +0200 |
commit | f96c892972444d7f73231c04a7f40375bd4ff811 (patch) | |
tree | 07e392e510d2a6b4e15be3783065da53beff4df6 /src/reducer | |
parent | 6516ced3f6bdbedb43a40023f3336097662bfc03 (diff) | |
download | anastasis-f96c892972444d7f73231c04a7f40375bd4ff811.tar.gz anastasis-f96c892972444d7f73231c04a7f40375bd4ff811.tar.bz2 anastasis-f96c892972444d7f73231c04a7f40375bd4ff811.zip |
-rename fest for #7222
Diffstat (limited to 'src/reducer')
-rw-r--r-- | src/reducer/anastasis_api_backup_redux.c | 60 | ||||
-rw-r--r-- | src/reducer/anastasis_api_redux.c | 15 |
2 files changed, 37 insertions, 38 deletions
diff --git a/src/reducer/anastasis_api_backup_redux.c b/src/reducer/anastasis_api_backup_redux.c index a97e6dc..9a9b3ad 100644 --- a/src/reducer/anastasis_api_backup_redux.c +++ b/src/reducer/anastasis_api_backup_redux.c @@ -357,9 +357,11 @@ add_authentication (json_t *state, json_t *method; size_t index; uint32_t size_limit_in_mb = 0; - bool disabled = false; + const char *status; uint32_t http_status = 0; struct GNUNET_JSON_Specification ispec[] = { + GNUNET_JSON_spec_string ("status", + &status), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", &size_limit_in_mb), @@ -369,10 +371,6 @@ add_authentication (json_t *state, &http_status), NULL), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_bool ("disabled", - &disabled), - NULL), - GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_json ("methods", &methods), NULL), @@ -387,7 +385,8 @@ add_authentication (json_t *state, GNUNET_break (0); continue; } - if (disabled) + if (0 != strcmp (status, + "ok")) continue; if (MHD_HTTP_OK != http_status) continue; /* skip providers that are down */ @@ -1946,8 +1945,8 @@ add_policy (json_t *state, { const char *provider_url; uint32_t method_idx; - json_t *prov_methods; const char *method_type; + json_t *prov_methods; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("provider", &provider_url), @@ -1973,13 +1972,11 @@ add_policy (json_t *state, { const json_t *prov_cfg; uint32_t limit; - bool disabled = false; + const char *status; uint32_t http_status = 0; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_bool ("disabled", - &disabled), - NULL), + GNUNET_JSON_spec_string ("status", + &status), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("http_status", &http_status), @@ -2013,7 +2010,8 @@ add_policy (json_t *state, continue; } if ( (MHD_HTTP_OK != http_status) || - disabled) + (0 != strcmp (status, + "ok")) ) { /* skip provider, disabled or down */ json_decref (methods); @@ -2455,13 +2453,11 @@ update_expiration_cost (json_t *state, json_object_foreach (providers, url, provider) { struct TALER_Amount annual_fee; - bool disabled = false; + const char *status; uint32_t http_status = 0; struct GNUNET_JSON_Specification pspec[] = { - GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_bool ("disabled", - &disabled), - NULL), + GNUNET_JSON_spec_string ("status", + &status), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("http_status", &http_status), @@ -2477,12 +2473,12 @@ update_expiration_cost (json_t *state, pspec, NULL, NULL)) { - /* strange, skip as well */ - GNUNET_break_op (0); + /* likely down, skip */ continue; } if ( (MHD_HTTP_OK != http_status) || - disabled) + (0 != strcmp (status, + "ok")) ) continue; /* skip providers that are down or disabled */ if (0 > TALER_amount_multiply (&fee, @@ -4228,13 +4224,11 @@ check_upload_size_limit (json_t *state, json_object_foreach (aps, url, ap) { uint32_t limit = 0; - bool disabled = false; + const char *status; uint32_t http_status = 0; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_bool ("disabled", - &disabled), - NULL), + GNUNET_JSON_spec_string ("status", + &status), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_uint32 ("http_status", &http_status), @@ -4256,7 +4250,8 @@ check_upload_size_limit (json_t *state, continue; } if ( (MHD_HTTP_OK != http_status) || - disabled) + (0 != strcmp (status, + "ok")) ) continue; if (0 == limit) return GNUNET_SYSERR; @@ -5064,12 +5059,10 @@ ANASTASIS_REDUX_backup_begin_ (json_t *state, json_object_foreach (provider_list, url, prov) { struct BackupStartStateProviderEntry *pe; json_t *istate; - bool disabled = false; + const char *status; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_bool ("disabled", - &disabled), - NULL), + GNUNET_JSON_spec_string ("status", + &status), GNUNET_JSON_spec_end () }; @@ -5082,7 +5075,8 @@ ANASTASIS_REDUX_backup_begin_ (json_t *state, GNUNET_break_op (0); continue; } - if (disabled) + if (0 == strcmp (status, + "disabled")) continue; pe = GNUNET_new (struct BackupStartStateProviderEntry); pe->bss = bss; diff --git a/src/reducer/anastasis_api_redux.c b/src/reducer/anastasis_api_redux.c index 1dba576..b66eec3 100644 --- a/src/reducer/anastasis_api_redux.c +++ b/src/reducer/anastasis_api_redux.c @@ -493,13 +493,11 @@ notify_waiting (struct ConfigRequest *cr) "authentication_providers", provider_list = json_object ())); } - provider_list = json_object_get (w->state, - "authentication_providers"); - GNUNET_assert (NULL != provider_list); - if (TALER_EC_NONE != cr->ec) { prov = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("status", + "error"), GNUNET_JSON_pack_uint64 ("error_code", cr->ec), GNUNET_JSON_pack_uint64 ("http_status", @@ -525,6 +523,8 @@ notify_waiting (struct ConfigRequest *cr) mj)); } prov = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("status", + "ok"), GNUNET_JSON_pack_array_steal ("methods", methods_list), TALER_JSON_pack_amount ("annual_fee", @@ -754,6 +754,7 @@ begin_provider_config_check (const json_t *currencies, &cur), GNUNET_JSON_spec_end () }; + json_t *prov; if (GNUNET_OK != GNUNET_JSON_parse (provider, @@ -786,10 +787,14 @@ begin_provider_config_check (const json_t *currencies, if (! found) continue; } + prov = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("status", + "not-contacted")); + GNUNET_assert (NULL != prov); GNUNET_assert (0 == json_object_set_new (pl, url, - json_object ())); + prov)); check_config (url); } GNUNET_assert (0 == |