From 661bd552f0c2f6ba77860dae633322ddaf19bd6d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 31 Jul 2023 18:32:20 +0200 Subject: future-proof API --- src/restclient/anastasis_api_policy_meta_lookup.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/restclient/anastasis_api_policy_meta_lookup.c') diff --git a/src/restclient/anastasis_api_policy_meta_lookup.c b/src/restclient/anastasis_api_policy_meta_lookup.c index 3d1482f..cf381fd 100644 --- a/src/restclient/anastasis_api_policy_meta_lookup.c +++ b/src/restclient/anastasis_api_policy_meta_lookup.c @@ -90,6 +90,10 @@ handle_policy_meta_lookup_finished (void *cls, { struct ANASTASIS_PolicyMetaLookupOperation *plo = cls; const json_t *json = response; + struct ANASTASIS_MetaDownloadDetails mdd = { + .http_status = response_code, + .response = json + }; plo->job = NULL; switch (response_code) @@ -116,10 +120,6 @@ handle_policy_meta_lookup_finished (void *cls, { struct ANASTASIS_MetaDataEntry metas[GNUNET_NZL (mlen)]; void *md[GNUNET_NZL (mlen)]; - struct ANASTASIS_MetaDownloadDetails mdd = { - .metas = metas, - .metas_length = mlen - }; size_t off = 0; const char *label; const json_t *val; @@ -127,6 +127,8 @@ handle_policy_meta_lookup_finished (void *cls, memset (md, 0, sizeof (md)); + mdd.details.ok.metas = metas; + mdd.details.ok.metas_length = mlen; json_object_foreach ((json_t *) json, label, val) @@ -148,6 +150,8 @@ handle_policy_meta_lookup_finished (void *cls, &dummy)) { GNUNET_break (0); + mdd.http_status = 0; + mdd.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } if (GNUNET_OK != @@ -156,6 +160,8 @@ handle_policy_meta_lookup_finished (void *cls, NULL, NULL)) { GNUNET_break_op (0); + mdd.http_status = 0; + mdd.ec = TALER_EC_GENERIC_REPLY_MALFORMED; break; } metas[off].version = (uint32_t) ver; @@ -165,13 +171,13 @@ handle_policy_meta_lookup_finished (void *cls, if (off < mlen) { GNUNET_break (0); - response_code = 0; + mdd.http_status = 0; + mdd.ec = TALER_EC_GENERIC_REPLY_MALFORMED; for (size_t i = 0; icb (plo->cb_cls, - response_code, &mdd); for (size_t i = 0; icb (plo->cb_cls, - response_code, - NULL); + &mdd); plo->cb = NULL; ANASTASIS_policy_meta_lookup_cancel (plo); } -- cgit v1.2.3