[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: fix misc. long polling issues
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: fix misc. long polling issues |
Date: |
Mon, 09 Sep 2024 23:20:47 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new d6aeaba4 fix misc. long polling issues
d6aeaba4 is described below
commit d6aeaba40b59d30cd2963766b0d6a337d9249fc0
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Sep 9 23:20:40 2024 +0200
fix misc. long polling issues
---
...r-merchant-httpd_private-get-instances-ID-kyc.c | 27 ++++++++++++++++------
src/backend/taler-merchant-kyccheck.c | 20 ++++++++++++----
src/testing/test_kyc_api.c | 4 ++--
src/testing/test_kyc_api.conf | 3 +++
4 files changed, 41 insertions(+), 13 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c
b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c
index 7fb229b2..c2990ebd 100644
--- a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c
+++ b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c
@@ -384,10 +384,12 @@ resume_kyc_with_response (struct KycContext *kc)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Resuming /kyc handling as exchange interaction is done (%u)\n",
MHD_HTTP_OK);
- GNUNET_assert (GNUNET_YES == kc->suspended);
- kc->suspended = GNUNET_NO;
- MHD_resume_connection (kc->connection);
- TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
+ if (GNUNET_YES == kc->suspended)
+ {
+ kc->suspended = GNUNET_NO;
+ MHD_resume_connection (kc->connection);
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
+ }
}
@@ -579,9 +581,20 @@ ekr_finished (struct ExchangeKycRequest *ekr)
if ( (! kc->return_immediately) &&
(! GNUNET_TIME_absolute_is_past (kc->timeout)) )
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Remaining suspended: long poll target %d not reached\n",
- kc->lpt);
+ if (GNUNET_NO == kc->suspended)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Suspending: long poll target %d not reached\n",
+ kc->lpt);
+ MHD_suspend_connection (kc->connection);
+ kc->suspended = GNUNET_YES;
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Remaining suspended: long poll target %d not reached\n",
+ kc->lpt);
+ }
return;
}
/* All exchange requests done, create final
diff --git a/src/backend/taler-merchant-kyccheck.c
b/src/backend/taler-merchant-kyccheck.c
index 2ff290d3..9bd72822 100644
--- a/src/backend/taler-merchant-kyccheck.c
+++ b/src/backend/taler-merchant-kyccheck.c
@@ -460,6 +460,7 @@ exchange_check_cb (
const struct TALER_EXCHANGE_KycStatus *ks)
{
struct Inquiry *i = cls;
+ bool progress = false;
i->kyc = NULL;
i->last_http_status = ks->hr.http_status;
@@ -472,6 +473,8 @@ exchange_check_cb (
switch (ks->hr.http_status)
{
case MHD_HTTP_OK:
+ if (! i->kyc_ok)
+ progress = true;
i->last_kyc_check = GNUNET_TIME_timestamp_get ();
/* exchange says KYC is OK, gives status information */
store_kyc_status (i,
@@ -479,7 +482,8 @@ exchange_check_cb (
i->backoff = GNUNET_TIME_UNIT_ZERO;
if (i->aml_review)
{
- i->due = GNUNET_TIME_relative_to_absolute (AML_FREQ);
+ if (! progress)
+ i->due = GNUNET_TIME_relative_to_absolute (AML_FREQ);
}
else
{
@@ -488,14 +492,17 @@ exchange_check_cb (
}
break;
case MHD_HTTP_ACCEPTED:
+ progress = ! i->auth_ok;
i->last_kyc_check = GNUNET_TIME_timestamp_get ();
+
/* exchange says KYC is required */
store_kyc_status (i,
&ks->details.accepted);
i->backoff = GNUNET_TIME_UNIT_ZERO;
/* Start immediately with long-polling */
- i->due = GNUNET_TIME_absolute_max (i->last_kyc_check.abs_time,
- i->timeout);
+ if (! progress)
+ i->due = GNUNET_TIME_absolute_max (i->last_kyc_check.abs_time,
+ i->timeout);
break;
case MHD_HTTP_NO_CONTENT:
i->last_kyc_check = GNUNET_TIME_timestamp_get ();
@@ -580,6 +587,11 @@ exchange_check_cb (
return;
}
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Will repeat inquiry in %s\n",
+ GNUNET_TIME_relative2s (
+ GNUNET_TIME_absolute_get_remaining (i->due),
+ true));
if (! GNUNET_TIME_absolute_is_never (i->due))
i->task = GNUNET_SCHEDULER_add_at (i->due,
&inquiry_work,
@@ -622,7 +634,7 @@ inquiry_work (void *cls)
= GNUNET_TIME_relative_to_absolute (EXCHANGE_TIMEOUT);
lpt = TALER_EXCHANGE_KLPT_NONE;
if (! i->auth_ok)
- lpt = TALER_EXCHANGE_KLPT_NONE;
+ lpt = TALER_EXCHANGE_KLPT_KYC_AUTH_TRANSFER;
else if (! i->kyc_ok)
lpt = TALER_EXCHANGE_KLPT_KYC_OK;
else if (i->aml_review)
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index 53e2818f..5a42439b 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -241,7 +241,7 @@ run (void *cls,
NULL,
EXCHANGE_URL,
TALER_EXCHANGE_KLPT_NONE,
- MHD_HTTP_OK,
+ MHD_HTTP_NO_CONTENT,
true),
/* now we get the legi UUID by running taler-merchant-depositcheck */
TALER_TESTING_cmd_depositcheck (
@@ -457,7 +457,7 @@ run (void *cls,
EXCHANGE_URL,
TALER_EXCHANGE_KLPT_KYC_OK,
MHD_HTTP_OK,
- false),
+ true),
CMD_EXEC_AGGREGATOR ("run-aggregator-aml-normal"),
TALER_TESTING_cmd_check_bank_transfer (
"check_bank_transfer-498c-post-unfreeze",
diff --git a/src/testing/test_kyc_api.conf b/src/testing/test_kyc_api.conf
index cd3e5c7e..6472d580 100644
--- a/src/testing/test_kyc_api.conf
+++ b/src/testing/test_kyc_api.conf
@@ -7,6 +7,9 @@ TALER_TEST_HOME = test_merchant_api_home/
CURRENCY = EUR
CURRENCY_ROUND_UNIT = EUR:0.01
+[merchant-exchange-kudos]
+DISABLED = YES
+
[taler-helper-crypto-rsa]
LOOKAHEAD_SIGN = 24 days
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: fix misc. long polling issues,
gnunet <=