gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: properly implement shutdown of /


From: gnunet
Subject: [taler-merchant] branch master updated: properly implement shutdown of /refund request
Date: Sun, 06 Sep 2020 13:03:07 +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 9f27b2b  properly implement shutdown of /refund request
9f27b2b is described below

commit 9f27b2bb79d177329317438c7b983801de38da00
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Sep 6 13:03:05 2020 +0200

    properly implement shutdown of /refund request
---
 .../taler-merchant-httpd_post-orders-ID-refund.c   | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)

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 31d0a86..86b62c9 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
@@ -253,6 +253,44 @@ static struct PostRefundData *prd_head;
 static struct PostRefundData *prd_tail;
 
 
+/**
+ * Function called when we are done processing a refund request.
+ * Frees memory associated with @a ctx.
+ *
+ * @param ctx a `struct PostRefundData`
+ */
+static void
+refund_cleanup (void *ctx)
+{
+  struct PostRefundData *prd = ctx;
+  struct CoinRefund *cr;
+
+  while (NULL != (cr = prd->cr_head))
+  {
+    GNUNET_CONTAINER_DLL_remove (prd->cr_head,
+                                 prd->cr_tail,
+                                 cr);
+    json_decref (cr->exchange_reply);
+    GNUNET_free (cr->exchange_url);
+    if (NULL != cr->fo)
+    {
+      TMH_EXCHANGES_find_exchange_cancel (cr->fo);
+      cr->fo = NULL;
+    }
+    if (NULL != cr->rh)
+    {
+      TALER_EXCHANGE_refund_cancel (cr->rh);
+      cr->rh = NULL;
+    }
+    GNUNET_free (cr);
+  }
+
+  json_decref (prd->contract_terms);
+
+  GNUNET_free (prd);
+}
+
+
 /**
  * Force resuming all suspended order lookups, needed during shutdown.
  */
@@ -495,6 +533,8 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler 
*rh,
     prd->sc.con = connection;
     prd->hc = hc;
     prd->order_id = hc->infix;
+    hc->ctx = prd;
+    hc->cc = &refund_cleanup;
     {
       enum GNUNET_GenericReturnValue res;
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]