aboutsummaryrefslogtreecommitdiff
path: root/src/reducer/anastasis_api_backup_redux.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reducer/anastasis_api_backup_redux.c')
-rw-r--r--src/reducer/anastasis_api_backup_redux.c60
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,
357 json_t *method; 357 json_t *method;
358 size_t index; 358 size_t index;
359 uint32_t size_limit_in_mb = 0; 359 uint32_t size_limit_in_mb = 0;
360 bool disabled = false; 360 const char *status;
361 uint32_t http_status = 0; 361 uint32_t http_status = 0;
362 struct GNUNET_JSON_Specification ispec[] = { 362 struct GNUNET_JSON_Specification ispec[] = {
363 GNUNET_JSON_spec_string ("status",
364 &status),
363 GNUNET_JSON_spec_mark_optional ( 365 GNUNET_JSON_spec_mark_optional (
364 GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes", 366 GNUNET_JSON_spec_uint32 ("storage_limit_in_megabytes",
365 &size_limit_in_mb), 367 &size_limit_in_mb),
@@ -369,10 +371,6 @@ add_authentication (json_t *state,
369 &http_status), 371 &http_status),
370 NULL), 372 NULL),
371 GNUNET_JSON_spec_mark_optional ( 373 GNUNET_JSON_spec_mark_optional (
372 GNUNET_JSON_spec_bool ("disabled",
373 &disabled),
374 NULL),
375 GNUNET_JSON_spec_mark_optional (
376 GNUNET_JSON_spec_json ("methods", 374 GNUNET_JSON_spec_json ("methods",
377 &methods), 375 &methods),
378 NULL), 376 NULL),
@@ -387,7 +385,8 @@ add_authentication (json_t *state,
387 GNUNET_break (0); 385 GNUNET_break (0);
388 continue; 386 continue;
389 } 387 }
390 if (disabled) 388 if (0 != strcmp (status,
389 "ok"))
391 continue; 390 continue;
392 if (MHD_HTTP_OK != http_status) 391 if (MHD_HTTP_OK != http_status)
393 continue; /* skip providers that are down */ 392 continue; /* skip providers that are down */
@@ -1946,8 +1945,8 @@ add_policy (json_t *state,
1946 { 1945 {
1947 const char *provider_url; 1946 const char *provider_url;
1948 uint32_t method_idx; 1947 uint32_t method_idx;
1949 json_t *prov_methods;
1950 const char *method_type; 1948 const char *method_type;
1949 json_t *prov_methods;
1951 struct GNUNET_JSON_Specification spec[] = { 1950 struct GNUNET_JSON_Specification spec[] = {
1952 GNUNET_JSON_spec_string ("provider", 1951 GNUNET_JSON_spec_string ("provider",
1953 &provider_url), 1952 &provider_url),
@@ -1973,13 +1972,11 @@ add_policy (json_t *state,
1973 { 1972 {
1974 const json_t *prov_cfg; 1973 const json_t *prov_cfg;
1975 uint32_t limit; 1974 uint32_t limit;
1976 bool disabled = false; 1975 const char *status;
1977 uint32_t http_status = 0; 1976 uint32_t http_status = 0;
1978 struct GNUNET_JSON_Specification spec[] = { 1977 struct GNUNET_JSON_Specification spec[] = {
1979 GNUNET_JSON_spec_mark_optional ( 1978 GNUNET_JSON_spec_string ("status",
1980 GNUNET_JSON_spec_bool ("disabled", 1979 &status),
1981 &disabled),
1982 NULL),
1983 GNUNET_JSON_spec_mark_optional ( 1980 GNUNET_JSON_spec_mark_optional (
1984 GNUNET_JSON_spec_uint32 ("http_status", 1981 GNUNET_JSON_spec_uint32 ("http_status",
1985 &http_status), 1982 &http_status),
@@ -2013,7 +2010,8 @@ add_policy (json_t *state,
2013 continue; 2010 continue;
2014 } 2011 }
2015 if ( (MHD_HTTP_OK != http_status) || 2012 if ( (MHD_HTTP_OK != http_status) ||
2016 disabled) 2013 (0 != strcmp (status,
2014 "ok")) )
2017 { 2015 {
2018 /* skip provider, disabled or down */ 2016 /* skip provider, disabled or down */
2019 json_decref (methods); 2017 json_decref (methods);
@@ -2455,13 +2453,11 @@ update_expiration_cost (json_t *state,
2455 json_object_foreach (providers, url, provider) 2453 json_object_foreach (providers, url, provider)
2456 { 2454 {
2457 struct TALER_Amount annual_fee; 2455 struct TALER_Amount annual_fee;
2458 bool disabled = false; 2456 const char *status;
2459 uint32_t http_status = 0; 2457 uint32_t http_status = 0;
2460 struct GNUNET_JSON_Specification pspec[] = { 2458 struct GNUNET_JSON_Specification pspec[] = {
2461 GNUNET_JSON_spec_mark_optional ( 2459 GNUNET_JSON_spec_string ("status",
2462 GNUNET_JSON_spec_bool ("disabled", 2460 &status),
2463 &disabled),
2464 NULL),
2465 GNUNET_JSON_spec_mark_optional ( 2461 GNUNET_JSON_spec_mark_optional (
2466 GNUNET_JSON_spec_uint32 ("http_status", 2462 GNUNET_JSON_spec_uint32 ("http_status",
2467 &http_status), 2463 &http_status),
@@ -2477,12 +2473,12 @@ update_expiration_cost (json_t *state,
2477 pspec, 2473 pspec,
2478 NULL, NULL)) 2474 NULL, NULL))
2479 { 2475 {
2480 /* strange, skip as well */ 2476 /* likely down, skip */
2481 GNUNET_break_op (0);
2482 continue; 2477 continue;
2483 } 2478 }
2484 if ( (MHD_HTTP_OK != http_status) || 2479 if ( (MHD_HTTP_OK != http_status) ||
2485 disabled) 2480 (0 != strcmp (status,
2481 "ok")) )
2486 continue; /* skip providers that are down or disabled */ 2482 continue; /* skip providers that are down or disabled */
2487 if (0 > 2483 if (0 >
2488 TALER_amount_multiply (&fee, 2484 TALER_amount_multiply (&fee,
@@ -4228,13 +4224,11 @@ check_upload_size_limit (json_t *state,
4228 json_object_foreach (aps, url, ap) 4224 json_object_foreach (aps, url, ap)
4229 { 4225 {
4230 uint32_t limit = 0; 4226 uint32_t limit = 0;
4231 bool disabled = false; 4227 const char *status;
4232 uint32_t http_status = 0; 4228 uint32_t http_status = 0;
4233 struct GNUNET_JSON_Specification spec[] = { 4229 struct GNUNET_JSON_Specification spec[] = {
4234 GNUNET_JSON_spec_mark_optional ( 4230 GNUNET_JSON_spec_string ("status",
4235 GNUNET_JSON_spec_bool ("disabled", 4231 &status),
4236 &disabled),
4237 NULL),
4238 GNUNET_JSON_spec_mark_optional ( 4232 GNUNET_JSON_spec_mark_optional (
4239 GNUNET_JSON_spec_uint32 ("http_status", 4233 GNUNET_JSON_spec_uint32 ("http_status",
4240 &http_status), 4234 &http_status),
@@ -4256,7 +4250,8 @@ check_upload_size_limit (json_t *state,
4256 continue; 4250 continue;
4257 } 4251 }
4258 if ( (MHD_HTTP_OK != http_status) || 4252 if ( (MHD_HTTP_OK != http_status) ||
4259 disabled) 4253 (0 != strcmp (status,
4254 "ok")) )
4260 continue; 4255 continue;
4261 if (0 == limit) 4256 if (0 == limit)
4262 return GNUNET_SYSERR; 4257 return GNUNET_SYSERR;
@@ -5064,12 +5059,10 @@ ANASTASIS_REDUX_backup_begin_ (json_t *state,
5064 json_object_foreach (provider_list, url, prov) { 5059 json_object_foreach (provider_list, url, prov) {
5065 struct BackupStartStateProviderEntry *pe; 5060 struct BackupStartStateProviderEntry *pe;
5066 json_t *istate; 5061 json_t *istate;
5067 bool disabled = false; 5062 const char *status;
5068 struct GNUNET_JSON_Specification spec[] = { 5063 struct GNUNET_JSON_Specification spec[] = {
5069 GNUNET_JSON_spec_mark_optional ( 5064 GNUNET_JSON_spec_string ("status",
5070 GNUNET_JSON_spec_bool ("disabled", 5065 &status),
5071 &disabled),
5072 NULL),
5073 GNUNET_JSON_spec_end () 5066 GNUNET_JSON_spec_end ()
5074 }; 5067 };
5075 5068
@@ -5082,7 +5075,8 @@ ANASTASIS_REDUX_backup_begin_ (json_t *state,
5082 GNUNET_break_op (0); 5075 GNUNET_break_op (0);
5083 continue; 5076 continue;
5084 } 5077 }
5085 if (disabled) 5078 if (0 == strcmp (status,
5079 "disabled"))
5086 continue; 5080 continue;
5087 pe = GNUNET_new (struct BackupStartStateProviderEntry); 5081 pe = GNUNET_new (struct BackupStartStateProviderEntry);
5088 pe->bss = bss; 5082 pe->bss = bss;