merchant

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

commit c748ea3e7032c358c78ef4f076d2b7f37f9d712e
parent 7bf6fdb81f2fe865bdab8f8644ab96801418f3ed
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun,  4 Jan 2026 14:45:06 +0100

-fix report generator

Diffstat:
Msrc/backend/taler-merchant-httpd_private-get-statistics-report-transactions.c | 23+++++++++++++++++++----
Msrc/backend/taler-merchant-report-generator.c | 6++++++
2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-get-statistics-report-transactions.c b/src/backend/taler-merchant-httpd_private-get-statistics-report-transactions.c @@ -104,6 +104,12 @@ struct ResponseContext */ json_t *data_groups; + /** + * #GNUNET_YES if connection was suspended, + * #GNUNET_SYSERR if we were resumed on shutdown. + */ + enum GNUNET_GenericReturnValue suspended; + }; @@ -128,6 +134,7 @@ TMH_handler_statistic_report_transactions_cleanup () GNUNET_CONTAINER_DLL_remove (rctx_head, rctx_tail, rctx); + rctx->suspended = GNUNET_SYSERR; MHD_resume_connection (rctx->hc->connection); } } @@ -179,6 +186,7 @@ pdf_cb (void *cls, GNUNET_CONTAINER_DLL_remove (rctx_head, rctx_tail, rctx); + rctx->suspended = GNUNET_NO; MHD_resume_connection (rctx->hc->connection); TALER_MHD_daemon_trigger (); if (TALER_EC_NONE != tr->ec) @@ -532,6 +540,9 @@ TMH_private_get_statistics_report_transactions ( if (NULL != rctx) { + GNUNET_assert (GNUNET_YES != rctx->suspended); + if (GNUNET_SYSERR == rctx->suspended) + return MHD_NO; if (NULL == rctx->response) { GNUNET_break (0); @@ -716,11 +727,10 @@ TMH_private_get_statistics_report_transactions ( .form_name = "transactions", .data = root }; + static bool typst; - GNUNET_CONTAINER_DLL_insert (rctx_head, - rctx_tail, - rctx); - MHD_suspend_connection (connection); + GNUNET_assert (! typst); + typst = true; rctx->tc = TALER_MHD_typst (TMH_cfg, false, /* remove on exit */ "merchant", @@ -739,6 +749,11 @@ TMH_private_get_statistics_report_transactions ( TALER_EC_EXCHANGE_GENERIC_NO_TYPST_OR_PDFTK, NULL); } + GNUNET_CONTAINER_DLL_insert (rctx_head, + rctx_tail, + rctx); + rctx->suspended = GNUNET_YES; + MHD_suspend_connection (connection); return MHD_YES; } } /* end switch */ diff --git a/src/backend/taler-merchant-report-generator.c b/src/backend/taler-merchant-report-generator.c @@ -610,6 +610,10 @@ process_pending_report ( struct GNUNET_TIME_Absolute *next = cls; struct ReportActivity *ra; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Next report %llu is pending at %s\n", + (unsigned long long) report_id, + GNUNET_TIME_absolute2s (next_transmission)); *next = next_transmission; if (GNUNET_TIME_absolute_is_future (next_transmission)) return; @@ -665,6 +669,8 @@ check_pending_reports (void *cls) GNUNET_SCHEDULER_shutdown (); return; } + if (NULL != ra_head) + return; /* wait for completion */ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Found %d reports pending, next at %s\n", (int) qs,