merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 6191cf20fe3b1c0154c1b972a5465361ee744d3a
parent 373c5628ab995d084c8df690a7659e5f17ffb906
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri, 13 Sep 2024 20:35:28 +0200

fix #9184: never long-poll on first request

Diffstat:
Msrc/backend/taler-merchant-kyccheck.c | 22+++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/backend/taler-merchant-kyccheck.c b/src/backend/taler-merchant-kyccheck.c @@ -35,16 +35,16 @@ * long-polling and do not want to wake up too often. */ #define EXCHANGE_TIMEOUT GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_MINUTES, \ - 30) + GNUNET_TIME_UNIT_MINUTES, \ + 30) /** * How long do we wait between requests if all we wait * for is a change in the AML investigation status? */ #define AML_FREQ GNUNET_TIME_relative_multiply ( \ - GNUNET_TIME_UNIT_HOURS, \ - 6) + GNUNET_TIME_UNIT_HOURS, \ + 6) /** * How many inquiries do we process concurrently at most. @@ -213,6 +213,11 @@ struct Inquiry enum TALER_ErrorCode last_ec; /** + * True if this is not our first time we make this request. + */ + bool not_first_time; + + /** * Did we not run this inquiry due to limits? */ bool limited; @@ -586,6 +591,7 @@ exchange_check_cb ( GNUNET_SCHEDULER_shutdown (); return; } + i->not_first_time = true; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Will repeat inquiry in %s\n", @@ -639,13 +645,17 @@ inquiry_work (void *cls) lpt = TALER_EXCHANGE_KLPT_KYC_OK; else if (i->aml_review) lpt = TALER_EXCHANGE_KLPT_INVESTIGATION_DONE; + if (! i->not_first_time) + lpt = TALER_EXCHANGE_KLPT_NONE; i->kyc = TALER_EXCHANGE_kyc_check ( ctx, i->e->keys->exchange_url, &i->a->h_payto, &i->a->ap, lpt, - EXCHANGE_TIMEOUT, + i->not_first_time + ? EXCHANGE_TIMEOUT + : GNUNET_TIME_UNIT_ZERO, &exchange_check_cb, i); if (NULL == i->kyc) @@ -743,6 +753,8 @@ start_inquiry (struct Exchange *e, GNUNET_SCHEDULER_shutdown (); return; } + if (qs > 0) + i->not_first_time = true; switch (i->last_http_status) { case MHD_HTTP_OK: