From af77a2a178a818abe851e4e25e768e2c1963b49c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 21 Jun 2023 08:15:06 +0200 Subject: -more auditor API atomization --- src/lib/exchange_api_deposit.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/lib/exchange_api_deposit.c') diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c index 5a0073f3f..6f8d348f4 100644 --- a/src/lib/exchange_api_deposit.c +++ b/src/lib/exchange_api_deposit.c @@ -1,6 +1,6 @@ /* This file is part of TALER - Copyright (C) 2014-2021 Taler Systems SA + Copyright (C) 2014-2023 Taler Systems SA TALER is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -55,6 +55,11 @@ struct TALER_EXCHANGE_DepositHandle */ struct TALER_EXCHANGE_Handle *exchange; + /** + * Our CURL context. + */ + struct GNUNET_CURL_Context *ctx; + /** * The url for this request. */ @@ -64,7 +69,7 @@ struct TALER_EXCHANGE_DepositHandle * Context for #TEH_curl_easy_post(). Keeps the data that must * persist for Curl to make the upload. */ - struct TALER_CURL_PostContext ctx; + struct TALER_CURL_PostContext post_ctx; /** * Handle for the request. @@ -131,13 +136,13 @@ struct TALER_EXCHANGE_DepositHandle * launch a deposit confirmation interaction. * * @param cls closure - * @param ah handle to the auditor + * @param auditor_url base URL of the auditor * @param auditor_pub public key of the auditor * @return NULL if no deposit confirmation interaction was launched */ static struct TEAH_AuditorInteractionEntry * auditor_cb (void *cls, - struct TALER_AUDITOR_Handle *ah, + const char *auditor_url, const struct TALER_AuditorPublicKeyP *auditor_pub) { struct TALER_EXCHANGE_DepositHandle *dh = cls; @@ -175,7 +180,8 @@ auditor_cb (void *cls, &dki->fees.deposit)); aie = GNUNET_new (struct TEAH_AuditorInteractionEntry); aie->dch = TALER_AUDITOR_deposit_confirmation ( - ah, + dh->ctx, + auditor_url, &dh->h_wire, &dh->h_policy, &dh->dcd.h_contract_terms, @@ -389,7 +395,6 @@ TALER_EXCHANGE_deposit ( { const struct TALER_EXCHANGE_Keys *key_state; struct TALER_EXCHANGE_DepositHandle *dh; - struct GNUNET_CURL_Context *ctx; json_t *deposit_obj; CURL *eh; const struct TALER_EXCHANGE_DenomPublicKey *dki; @@ -506,7 +511,7 @@ TALER_EXCHANGE_deposit ( eh = TALER_EXCHANGE_curl_easy_get_ (dh->url); if ( (NULL == eh) || (GNUNET_OK != - TALER_curl_easy_post (&dh->ctx, + TALER_curl_easy_post (&dh->post_ctx, eh, deposit_obj)) ) { @@ -523,10 +528,10 @@ TALER_EXCHANGE_deposit ( GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "URL for deposit: `%s'\n", dh->url); - ctx = TEAH_handle_to_context (exchange); - dh->job = GNUNET_CURL_job_add2 (ctx, + dh->ctx = TEAH_handle_to_context (exchange); + dh->job = GNUNET_CURL_job_add2 (dh->ctx, eh, - dh->ctx.headers, + dh->post_ctx.headers, &handle_deposit_finished, dh); return dh; @@ -549,7 +554,7 @@ TALER_EXCHANGE_deposit_cancel (struct TALER_EXCHANGE_DepositHandle *deposit) deposit->job = NULL; } GNUNET_free (deposit->url); - TALER_curl_easy_post_finished (&deposit->ctx); + TALER_curl_easy_post_finished (&deposit->post_ctx); GNUNET_free (deposit); } -- cgit v1.2.3