diff options
-rw-r--r-- | src/cli/resources/02-backup.json | 8 | ||||
-rw-r--r-- | src/cli/resources/02-recovery.json | 8 | ||||
-rw-r--r-- | src/cli/resources/03-backup.json | 4 | ||||
-rw-r--r-- | src/cli/resources/04-backup.json | 4 | ||||
-rw-r--r-- | src/cli/resources/05-backup.json | 4 | ||||
-rw-r--r-- | src/cli/resources/06-backup.json | 4 | ||||
-rw-r--r-- | src/reducer/anastasis_api_backup_redux.c | 60 | ||||
-rw-r--r-- | src/reducer/anastasis_api_redux.c | 15 |
8 files changed, 61 insertions, 46 deletions
diff --git a/src/cli/resources/02-backup.json b/src/cli/resources/02-backup.json index 67df7e0..05ccab1 100644 --- a/src/cli/resources/02-backup.json +++ b/src/cli/resources/02-backup.json @@ -40,10 +40,10 @@ } ], "authentication_providers": { - "http://localhost:8086/": {}, - "http://localhost:8087/": {}, - "http://localhost:8088/": {}, - "http://localhost:8089/": {} + "http://localhost:8086/": { "status" : "not-contacted" }, + "http://localhost:8087/": { "status" : "not-contacted" }, + "http://localhost:8088/": { "status" : "not-contacted" }, + "http://localhost:8089/": { "status" : "not-contacted" } }, "selected_country": "xx", "currencies": [ "TESTKUDOS" ], diff --git a/src/cli/resources/02-recovery.json b/src/cli/resources/02-recovery.json index e77ed0c..875fae0 100644 --- a/src/cli/resources/02-recovery.json +++ b/src/cli/resources/02-recovery.json @@ -40,10 +40,10 @@ } ], "authentication_providers": { - "http://localhost:8086/": {}, - "http://localhost:8087/": {}, - "http://localhost:8088/": {}, - "http://localhost:8089/": {} + "http://localhost:8086/": { "status" : "not-contacted" }, + "http://localhost:8087/": { "status" : "not-contacted" }, + "http://localhost:8088/": { "status" : "not-contacted" }, + "http://localhost:8089/": { "status" : "not-contacted" } }, "selected_country": "xx", "currencies": [ "TESTKUDOS" ], diff --git a/src/cli/resources/03-backup.json b/src/cli/resources/03-backup.json index ad9d23b..838b669 100644 --- a/src/cli/resources/03-backup.json +++ b/src/cli/resources/03-backup.json @@ -41,6 +41,7 @@ ], "authentication_providers": { "http://localhost:8086/": { + "status" : "ok", "methods": [ { "type": "question", @@ -60,6 +61,7 @@ "http_status": 200 }, "http://localhost:8087/": { + "status" : "ok", "methods": [ { "type": "question", @@ -79,6 +81,7 @@ "http_status": 200 }, "http://localhost:8088/": { + "status" : "ok", "methods": [ { "type": "question", @@ -98,6 +101,7 @@ "http_status": 200 }, "http://localhost:8089/": { + "status" : "ok", "methods": [ { "type": "question", diff --git a/src/cli/resources/04-backup.json b/src/cli/resources/04-backup.json index 34cabfd..3676f3e 100644 --- a/src/cli/resources/04-backup.json +++ b/src/cli/resources/04-backup.json @@ -41,6 +41,7 @@ ], "authentication_providers": { "http://localhost:8086/": { + "status" : "ok", "methods": [ { "type": "question", @@ -60,6 +61,7 @@ "http_status": 200 }, "http://localhost:8087/": { + "status" : "ok", "methods": [ { "type": "question", @@ -79,6 +81,7 @@ "http_status": 200 }, "http://localhost:8088/": { + "status" : "ok", "methods": [ { "type": "question", @@ -98,6 +101,7 @@ "http_status": 200 }, "http://localhost:8089/": { + "status" : "ok", "methods": [ { "type": "question", diff --git a/src/cli/resources/05-backup.json b/src/cli/resources/05-backup.json index bb988be..c8f52f0 100644 --- a/src/cli/resources/05-backup.json +++ b/src/cli/resources/05-backup.json @@ -41,6 +41,7 @@ ], "authentication_providers": { "http://localhost:8086/": { + "status" : "ok", "methods": [ { "type": "question", @@ -60,6 +61,7 @@ "http_status": 200 }, "http://localhost:8087/": { + "status" : "ok", "methods": [ { "type": "question", @@ -79,6 +81,7 @@ "http_status": 200 }, "http://localhost:8088/": { + "status" : "ok", "methods": [ { "type": "question", @@ -98,6 +101,7 @@ "http_status": 200 }, "http://localhost:8089/": { + "status" : "ok", "methods": [ { "type": "question", diff --git a/src/cli/resources/06-backup.json b/src/cli/resources/06-backup.json index 23a8927..04d8b02 100644 --- a/src/cli/resources/06-backup.json +++ b/src/cli/resources/06-backup.json @@ -41,6 +41,7 @@ ], "authentication_providers": { "http://localhost:8086/": { + "status" : "ok", "methods": [ { "type": "question", @@ -60,6 +61,7 @@ "http_status": 200 }, "http://localhost:8087/": { + "status" : "ok", "methods": [ { "type": "question", @@ -79,6 +81,7 @@ "http_status": 200 }, "http://localhost:8088/": { + "status" : "ok", "methods": [ { "type": "question", @@ -98,6 +101,7 @@ "http_status": 200 }, "http://localhost:8089/": { + "status" : "ok", "methods": [ { "type": "question", 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 == |