gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: do not loop if refund fails (#65


From: gnunet
Subject: [taler-merchant] branch master updated: do not loop if refund fails (#6577)
Date: Sun, 06 Sep 2020 12:50:36 +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 c528a4c  do not loop if refund fails (#6577)
c528a4c is described below

commit c528a4ceda11a6f4c10100b122057d2ee45a7613
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Sep 6 12:50:20 2020 +0200

    do not loop if refund fails (#6577)
---
 .../taler-merchant-httpd_post-orders-ID-refund.c   | 34 ++++++++++++++--------
 1 file changed, 22 insertions(+), 12 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 18fca9a..31d0a86 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
@@ -436,6 +436,13 @@ process_refunds_cb (void *cls,
   struct PostRefundData *prd = cls;
   struct CoinRefund *cr;
 
+  for (cr = prd->cr_head;
+       NULL != cr;
+       cr = cr->next)
+    if (cr->refund_serial == refund_serial)
+      return;
+  /* already known */
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Found refund of %s for coin %s with reason `%s' in database\n",
               TALER_amount2s (refund_amount),
@@ -598,17 +605,20 @@ TMH_post_orders_ID_refund (const struct 
TMH_RequestHandler *rh,
                                          TALER_EC_GET_ORDERS_DB_LOOKUP_ERROR,
                                          NULL);
     case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
-      /* We need to talk to the exchange */
-      /* 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,
-                                            &exchange_found_cb,
-                                            cr);
+      if (NULL == cr->exchange_reply)
+      {
+        /* We need to talk to the exchange */
+        /* 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,
+                                              &exchange_found_cb,
+                                              cr);
+      }
       break;
     case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
       /* We got a reply earlier, set status accordingly */
@@ -646,7 +656,7 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler 
*rh,
       {
         if (NULL == cr->exchange_reply)
         {
-          refund = json_pack ("{s:s, s:I,s:I,s:o,s:o,s:o}"
+          refund = json_pack ("{s:s,s:I,s:I,s:o,s:o,s:o}"
                               "type",
                               "failure",
                               "exchange_status",

-- 
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]