diff options
Diffstat (limited to 'src/reducer/anastasis_api_backup_redux.c')
-rw-r--r-- | src/reducer/anastasis_api_backup_redux.c | 60 |
1 files changed, 27 insertions, 33 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; |