commit 1a3692d3415c30eb36c990dfd2fe0063160ed488
parent 2ff04f3608220043cf5c025679a6f26344c4c9ab
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 10 Mar 2026 09:05:12 +0100
try to fix #11220
Diffstat:
1 file changed, 63 insertions(+), 39 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_get-private-kyc.c b/src/backend/taler-merchant-httpd_get-private-kyc.c
@@ -1068,6 +1068,9 @@ kyc_with_exchange (void *cls,
ekr_finished (ekr);
return;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Got /keys for `%s'\n",
+ ekr->exchange_url);
ekr->keys = TALER_EXCHANGE_keys_incref (keys);
if (! ekr->auth_ok)
{
@@ -1204,7 +1207,6 @@ kyc_status_cb (
"Account has unknown KYC status for all exchanges.\n");
TMH_exchange_get_trusted (&add_unreachable_status,
&uc);
- kc_respond (kc);
return;
}
if (! TMH_EXCHANGES_check_trusted (exchange_url))
@@ -1259,6 +1261,10 @@ kyc_status_cb (
if ( (! ekr->auth_ok) ||
(NULL == ekr->jlimits) )
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Awaiting /keys from `%s'\n",
+ exchange_url);
+
/* Figure out wire transfer instructions */
if (GNUNET_NO == kc->suspended)
{
@@ -1480,8 +1486,10 @@ get_instances_ID_kyc (
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"account_kyc_get_status returned %d records\n",
(int) qs);
- if (qs < 0)
+ switch (qs)
{
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ case GNUNET_DB_STATUS_SOFT_ERROR:
/* Database error */
GNUNET_break (0);
if (GNUNET_YES == kc->suspended)
@@ -1494,50 +1502,66 @@ get_instances_ID_kyc (
connection,
TALER_EC_GENERIC_DB_FETCH_FAILED,
"account_kyc_get_status");
- }
- if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
- {
- /* We use an Etag of all zeros for the 204 status code */
- static struct GNUNET_ShortHashCode zero_etag;
-
- /* no matching accounts, could not have suspended */
- GNUNET_assert (GNUNET_NO == kc->suspended);
- if (kc->have_lp_not_etag &&
- (0 == GNUNET_memcmp (&zero_etag,
- &kc->lp_not_etag)) &&
- (! GNUNET_TIME_absolute_is_past (kc->timeout)) )
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
{
+ /* We use an Etag of all zeros for the 204 status code */
+ static struct GNUNET_ShortHashCode zero_etag;
+
+ /* no matching accounts, could not have suspended */
+ GNUNET_assert (GNUNET_NO == kc->suspended);
+ if (kc->have_lp_not_etag &&
+ (0 == GNUNET_memcmp (&zero_etag,
+ &kc->lp_not_etag)) &&
+ (! GNUNET_TIME_absolute_is_past (kc->timeout)) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "No matching accounts, suspending to wait for this to change\n");
+ MHD_suspend_connection (kc->connection);
+ kc->suspended = GNUNET_YES;
+ return MHD_YES;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "No matching accounts, suspending to wait for this to change\n");
- MHD_suspend_connection (kc->connection);
- kc->suspended = GNUNET_YES;
- return MHD_YES;
+ "No matching accounts, returning empty response\n");
+ kc->response_code = MHD_HTTP_NO_CONTENT;
+ kc->response = MHD_create_response_from_buffer_static (0,
+ NULL);
+ TALER_MHD_add_global_headers (kc->response,
+ false);
+ {
+ char *etag;
+
+ etag = GNUNET_STRINGS_data_to_string_alloc (&zero_etag,
+ sizeof (zero_etag));
+ GNUNET_break (MHD_YES ==
+ MHD_add_response_header (kc->response,
+ MHD_HTTP_HEADER_ETAG,
+ etag));
+ GNUNET_free (etag);
+ }
+ return MHD_queue_response (connection,
+ kc->response_code,
+ kc->response);
}
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "No matching accounts, returning empty response\n");
- kc->response_code = MHD_HTTP_NO_CONTENT;
- kc->response = MHD_create_response_from_buffer_static (0,
- NULL);
- TALER_MHD_add_global_headers (kc->response,
- false);
- {
- char *etag;
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ break;
+ } /* end switch (qs) */
+ }
- etag = GNUNET_STRINGS_data_to_string_alloc (&zero_etag,
- sizeof (zero_etag));
- GNUNET_break (MHD_YES ==
- MHD_add_response_header (kc->response,
- MHD_HTTP_HEADER_ETAG,
- etag));
- GNUNET_free (etag);
- }
- return MHD_queue_response (connection,
- kc->response_code,
- kc->response);
- }
+ /* normal case, but maybe no async activity? In this case,
+ respond immediately */
+ if (NULL == kc->exchange_pending_head)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "No asynchronous activity, responding now\n");
+ kc_respond (kc);
}
if (GNUNET_YES == kc->suspended)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Request handling suspended, waiting for KYC status change\n");
return MHD_YES;
+ }
+
/* Should have generated a response */
GNUNET_break (NULL != kc->response);
return MHD_queue_response (connection,