diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-06-22 22:10:45 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-06-22 22:10:45 +0200 |
commit | bb0967ea0f5d501079981ea33f21f4c133815234 (patch) | |
tree | 76a8d987a60263f313c154f6af4fedc0006f7733 | |
parent | e89196cb4a857cae370b48d55a51cd7b6b6e752f (diff) |
adapt to exchange API change
-rw-r--r-- | src/backend/taler-merchant-httpd.h | 5 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_exchanges.c | 5 | ||||
-rw-r--r-- | src/backend/taler-merchant-httpd_reserves.c | 57 | ||||
-rw-r--r-- | src/merchant-tools/taler-merchant-benchmark.c | 6 |
4 files changed, 17 insertions, 56 deletions
diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h index 46bbcb5b..732c1bf3 100644 --- a/src/backend/taler-merchant-httpd.h +++ b/src/backend/taler-merchant-httpd.h @@ -637,6 +637,11 @@ extern char *TMH_currency; extern int TMH_force_audit; /** + * Context for all CURL operations (useful to the event loop) + */ +extern struct GNUNET_CURL_Context *merchant_curl_ctx; + +/** * Handle to the database backend. */ extern struct TALER_MERCHANTDB_Plugin *TMH_db; diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c index ddbc0dee..090cef95 100644 --- a/src/backend/taler-merchant-httpd_exchanges.c +++ b/src/backend/taler-merchant-httpd_exchanges.c @@ -334,9 +334,10 @@ struct TMH_Exchange /** - * Context for all exchange operations (useful to the event loop) + * Context for all exchange operations (useful to the event loop). + * FIXME: rename, move to taler-merchant-httpd.c */ -static struct GNUNET_CURL_Context *merchant_curl_ctx; +struct GNUNET_CURL_Context *merchant_curl_ctx; /** * Context for integrating #merchant_curl_ctx with the diff --git a/src/backend/taler-merchant-httpd_reserves.c b/src/backend/taler-merchant-httpd_reserves.c index 3d11a954..83b70010 100644 --- a/src/backend/taler-merchant-httpd_reserves.c +++ b/src/backend/taler-merchant-httpd_reserves.c @@ -71,11 +71,6 @@ struct Reserve char *instance_id; /** - * Active find operation for this reserve. - */ - struct TMH_EXCHANGES_FindOperation *fo; - - /** * Task scheduled waiting for a timeout for this reserve. */ struct GNUNET_SCHEDULER_Task *tt; @@ -124,11 +119,6 @@ free_reserve (struct Reserve *r) GNUNET_CONTAINER_DLL_remove (reserves_head, reserves_tail, r); - if (NULL != r->fo) - { - TMH_EXCHANGES_find_exchange_cancel (r->fo); - r->fo = NULL; - } if (NULL != r->gh) { TALER_EXCHANGE_reserves_get_cancel (r->gh); @@ -226,43 +216,6 @@ reserve_cb (void *cls, /** - * Function called with the result of a #TMH_EXCHANGES_find_exchange() - * operation. - * - * @param cls closure - * @param hr HTTP response details - * @param eh handle to the exchange context - * @param ih internal handle to the exchange - */ -static void -find_cb (void *cls, - const struct TALER_EXCHANGE_HttpResponse *hr, - struct TALER_EXCHANGE_Handle *eh, - struct TMH_Exchange *ih) -{ - struct Reserve *r = cls; - - (void) ih; - r->fo = NULL; - if (NULL == eh) - { - try_later (r); - return; - } - r->gh = TALER_EXCHANGE_reserves_get (eh, - &r->reserve_pub, - LONGPOLL_DELAY, - &reserve_cb, - r); - if (NULL == r->gh) - { - try_later (r); - return; - } -} - - -/** * Function called to probe a reserve now. * * @param cls a `struct Reserve` to query @@ -273,11 +226,13 @@ try_now (void *cls) struct Reserve *r = cls; r->tt = NULL; - r->fo = TMH_EXCHANGES_find_exchange (r->exchange_url, - false, - &find_cb, + r->gh = TALER_EXCHANGE_reserves_get (merchant_curl_ctx, + r->exchange_url, + &r->reserve_pub, + LONGPOLL_DELAY, + &reserve_cb, r); - if (NULL == r->fo) + if (NULL == r->gh) { try_later (r); return; diff --git a/src/merchant-tools/taler-merchant-benchmark.c b/src/merchant-tools/taler-merchant-benchmark.c index d60cfeed..b1b907ab 100644 --- a/src/merchant-tools/taler-merchant-benchmark.c +++ b/src/merchant-tools/taler-merchant-benchmark.c @@ -604,9 +604,9 @@ main (int argc, { int result; - result = TALER_TESTING_setup_with_exchange (&run, - NULL, - cfg_filename); + result = TALER_TESTING_xxx (&run, + NULL, + cfg_filename); terminate_process (merchantd); terminate_process (bankd); return (GNUNET_OK == result) ? 0 : PG_RUNTIME_FAILURE; |