diff options
author | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-08-19 03:28:38 -0400 |
---|---|---|
committer | Jonathan Buchanan <jonathan.russ.buchanan@gmail.com> | 2020-08-19 03:28:38 -0400 |
commit | b77ef665b0f3876f2c27db2d5a9b154fa1a9ba0d (patch) | |
tree | 37f482c473bf00f78218bdc1305d0980f5486895 /src/backend/taler-merchant-httpd_post-orders-ID-refund.c | |
parent | 807b6e0b125100b1dd8ec56521517522a0cbfd4f (diff) | |
download | merchant-b77ef665b0f3876f2c27db2d5a9b154fa1a9ba0d.tar.gz merchant-b77ef665b0f3876f2c27db2d5a9b154fa1a9ba0d.tar.bz2 merchant-b77ef665b0f3876f2c27db2d5a9b154fa1a9ba0d.zip |
long poll for pending refunds
Diffstat (limited to 'src/backend/taler-merchant-httpd_post-orders-ID-refund.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_post-orders-ID-refund.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c index bfdb6ca2..7fafdd5e 100644 --- a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c +++ b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c @@ -253,7 +253,24 @@ static struct PostRefundData *prd_head; static struct PostRefundData *prd_tail; -/* FIXME: Handle shutdown and other events that require ending all requests */ +/** + * Force resuming all suspended order lookups, needed during shutdown. + */ +void +TMH_force_wallet_refund_order_resume (void) +{ + struct PostRefundData *prd; + + while (NULL != (prd = prd_head)) + { + GNUNET_CONTAINER_DLL_remove (prd_head, + prd_tail, + prd); + GNUNET_assert (prd->suspended); + prd->suspended = false; + MHD_resume_connection (prd->sc.con); + } +} /** @@ -581,7 +598,11 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler *rh, "Merchant database error"); case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: /* We need to talk to the exchange */ - /* FIXME: notify clients polling for this to happen */ + /* Notify clients waiting for the refund to be obtained. */ + TMH_long_poll_resume (hc->infix, + hc->instance, + &prd->refund_amount, + true); cr->fo = TMH_EXCHANGES_find_exchange (cr->exchange_url, NULL, GNUNET_NO, |