gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: fix tip pickup MHD suspend/resum


From: gnunet
Subject: [taler-merchant] branch master updated: fix tip pickup MHD suspend/resume handling, code cleanup: use struct TALER_EXCHANGE_HttpResponse where appropriate
Date: Sun, 12 Apr 2020 16:02:04 +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 a0dd3ef  fix tip pickup MHD suspend/resume handling, code cleanup: use 
struct TALER_EXCHANGE_HttpResponse where appropriate
a0dd3ef is described below

commit a0dd3ef13d1dc5bca5af600eec7ed928526e2bf4
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Apr 12 16:02:00 2020 +0200

    fix tip pickup MHD suspend/resume handling, code cleanup: use struct 
TALER_EXCHANGE_HttpResponse where appropriate
---
 src/backend/taler-merchant-httpd.c                 |   1 +
 src/backend/taler-merchant-httpd_exchanges.c       |  47 +++---
 src/backend/taler-merchant-httpd_exchanges.h       |  11 +-
 src/backend/taler-merchant-httpd_pay.c             |  21 +--
 src/backend/taler-merchant-httpd_refund_lookup.c   |  19 +--
 src/backend/taler-merchant-httpd_tip-pickup.c      | 167 ++++++++++++++-------
 src/backend/taler-merchant-httpd_tip-pickup.h      |   8 +
 .../taler-merchant-httpd_tip-reserve-helper.c      |  11 +-
 .../taler-merchant-httpd_track-transaction.c       |  22 ++-
 src/backend/taler-merchant-httpd_track-transfer.c  |  22 ++-
 10 files changed, 183 insertions(+), 146 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c 
b/src/backend/taler-merchant-httpd.c
index f3c87f1..86b3630 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -524,6 +524,7 @@ do_shutdown (void *cls)
   MH_force_pc_resume ();
   MH_force_trh_resume ();
   MH_force_refund_resume ();
+  MH_force_tip_pickup_resume ();
   if (NULL != mhd_task)
   {
     GNUNET_SCHEDULER_cancel (mhd_task);
diff --git a/src/backend/taler-merchant-httpd_exchanges.c 
b/src/backend/taler-merchant-httpd_exchanges.c
index 48670fa..190f5db 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -570,13 +570,17 @@ process_find_operations (struct Exchange *exchange)
       /* no wire transfer method given, so we yield no fee */
       wire_fee = NULL;
     }
-    fo->fc (fo->fc_cls,
-            exchange->conn,
-            wire_fee,
-            exchange->trusted,
-            TALER_EC_NONE,
-            MHD_HTTP_OK,
-            NULL);
+    {
+      struct TALER_EXCHANGE_HttpResponse hr = {
+        .http_status = MHD_HTTP_OK,
+      };
+
+      fo->fc (fo->fc_cls,
+              &hr,
+              exchange->conn,
+              wire_fee,
+              exchange->trusted);
+    }
     TMH_EXCHANGES_find_exchange_cancel (fo);
   }
   return need_wire;
@@ -633,12 +637,10 @@ handle_wire_data (void *cls,
     while (NULL != (fo = exchange->fo_head))
     {
       fo->fc (fo->fc_cls,
+              hr,
               NULL,
               NULL,
-              GNUNET_NO,
-              hr->ec,
-              hr->http_status,
-              hr->reply);
+              GNUNET_NO);
       TMH_EXCHANGES_find_exchange_cancel (fo);
     }
     return;
@@ -653,17 +655,20 @@ handle_wire_data (void *cls,
   {
     /* Report hard failure to all callbacks! */
     struct TMH_EXCHANGES_FindOperation *fo;
+    struct TALER_EXCHANGE_HttpResponse hrx = {
+      .ec = ecx,
+      .http_status = 0,
+      .reply = hr->reply
+    };
 
     GNUNET_break_op (0);
     while (NULL != (fo = exchange->fo_head))
     {
       fo->fc (fo->fc_cls,
+              &hrx,
               NULL,
               NULL,
-              GNUNET_NO,
-              ecx,
-              0,
-              hr->reply);
+              GNUNET_NO);
       TMH_EXCHANGES_find_exchange_cancel (fo);
     }
     return;
@@ -676,9 +681,9 @@ handle_wire_data (void *cls,
     /* need to run /wire again. But as we DID get a successful reply,
        and as the exchange is unlikely to offer new wire methods very
        frequently, start with some significant delay */
-    exchange->wire_retry_delay = GNUNET_TIME_relative_max (
-      GNUNET_TIME_UNIT_MINUTES,
-      exchange->wire_retry_delay);
+    exchange->wire_retry_delay
+      = GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MINUTES,
+                                  exchange->wire_retry_delay);
     exchange->wire_retry_delay = RETRY_BACKOFF (exchange->wire_retry_delay);
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "Exchange does not support our wire method. Retrying in %s\n",
@@ -765,12 +770,10 @@ keys_mgmt_cb (void *cls,
     while (NULL != (fo = exchange->fo_head))
     {
       fo->fc (fo->fc_cls,
+              hr,
               NULL,
               NULL,
-              GNUNET_NO,
-              hr->ec,
-              hr->http_status,
-              hr->reply);
+              GNUNET_NO);
       TMH_EXCHANGES_find_exchange_cancel (fo);
     }
     if (TALER_EXCHANGE_VC_INCOMPATIBLE_NEWER == compat)
diff --git a/src/backend/taler-merchant-httpd_exchanges.h 
b/src/backend/taler-merchant-httpd_exchanges.h
index 523ed53..3a47408 100644
--- a/src/backend/taler-merchant-httpd_exchanges.h
+++ b/src/backend/taler-merchant-httpd_exchanges.h
@@ -59,22 +59,17 @@ TMH_EXCHANGES_done (void);
  * operation.
  *
  * @param cls closure
+ * @param hr HTTP response details
  * @param eh handle to the exchange context
  * @param wire_fee current applicable wire fee for dealing with @a eh, NULL if 
not available
  * @param exchange_trusted #GNUNET_YES if this exchange is trusted by config
- * @param ec error code, #TALER_EC_NONE on success
- * @param http_status the HTTP status we got from the exchange
- * @param error_reply the full reply from the exchange, NULL if
- *        the response was NOT in JSON or on success
  */
 typedef void
 (*TMH_EXCHANGES_FindContinuation)(void *cls,
+                                  const struct TALER_EXCHANGE_HttpResponse *hr,
                                   struct TALER_EXCHANGE_Handle *eh,
                                   const struct TALER_Amount *wire_fee,
-                                  int exchange_trusted,
-                                  enum TALER_ErrorCode ec,
-                                  unsigned int http_status,
-                                  const json_t *error_reply);
+                                  int exchange_trusted);
 
 
 /**
diff --git a/src/backend/taler-merchant-httpd_pay.c 
b/src/backend/taler-merchant-httpd_pay.c
index 446320b..7a1b7fd 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -1078,31 +1078,26 @@ deposit_cb (void *cls,
  * Function called with the result of our exchange lookup.
  *
  * @param cls the `struct PayContext`
+ * @param hr HTTP response details
  * @param mh NULL if exchange was not found to be acceptable
  * @param wire_fee current applicable fee for dealing with @a mh,
  *        NULL if not available
  * @param exchange_trusted #GNUNET_YES if this exchange is
  *        trusted by config
- * @param ec error code, #TALER_EC_NONE on success
- * @param http_status the HTTP status we got from the exchange
- * @param error_reply the full reply from the exchange, NULL if
- *        the response was NOT in JSON or on success
  */
 static void
 process_pay_with_exchange (void *cls,
+                           const struct TALER_EXCHANGE_HttpResponse *hr,
                            struct TALER_EXCHANGE_Handle *mh,
                            const struct TALER_Amount *wire_fee,
-                           int exchange_trusted,
-                           enum TALER_ErrorCode ec,
-                           unsigned int http_status,
-                           const json_t *error_reply)
+                           int exchange_trusted)
 {
   struct PayContext *pc = cls;
   const struct TALER_EXCHANGE_Keys *keys;
 
   pc->fo = NULL;
   GNUNET_assert (GNUNET_YES == pc->suspended);
-  if (MHD_HTTP_OK != http_status)
+  if (MHD_HTTP_OK != hr->http_status)
   {
     /* The request failed somehow */
     GNUNET_break_op (0);
@@ -1110,7 +1105,7 @@ process_pay_with_exchange (void *cls,
       pc,
       MHD_HTTP_FAILED_DEPENDENCY,
       TALER_MHD_make_json_pack (
-        (NULL != error_reply)
+        (NULL != hr->reply)
         ? "{s:s, s:I, s:I, s:I, s:O}"
         : "{s:s, s:I, s:I, s:I}",
         "hint",
@@ -1118,11 +1113,11 @@ process_pay_with_exchange (void *cls,
         "code",
         (json_int_t) TALER_EC_PAY_EXCHANGE_KEYS_FAILURE,
         "exchange_http_status",
-        (json_int_t) http_status,
+        (json_int_t) hr->http_status,
         "exchange_code",
-        (json_int_t) ec,
+        (json_int_t) hr->ec,
         "exchange_reply",
-        error_reply));
+        hr->reply));
     return;
   }
   pc->mh = mh;
diff --git a/src/backend/taler-merchant-httpd_refund_lookup.c 
b/src/backend/taler-merchant-httpd_refund_lookup.c
index 946f90d..e86e4e4 100644
--- a/src/backend/taler-merchant-httpd_refund_lookup.c
+++ b/src/backend/taler-merchant-httpd_refund_lookup.c
@@ -330,27 +330,22 @@ refund_cb (void *cls,
  * operation.
  *
  * @param cls a `struct CoinRefund *`
+ * @param hr HTTP response details
  * @param eh handle to the exchange context
  * @param wire_fee current applicable wire fee for dealing with @a eh, NULL if 
not available
  * @param exchange_trusted #GNUNET_YES if this exchange is trusted by config
- * @param ec error code, #TALER_EC_NONE on success
- * @param http_status the HTTP status we got from the exchange
- * @param error_reply the full reply from the exchange, NULL if
- *        the response was NOT in JSON or on success
  */
 static void
 exchange_found_cb (void *cls,
+                   const struct TALER_EXCHANGE_HttpResponse *hr,
                    struct TALER_EXCHANGE_Handle *eh,
                    const struct TALER_Amount *wire_fee,
-                   int exchange_trusted,
-                   enum TALER_ErrorCode ec,
-                   unsigned int http_status,
-                   const json_t *error_reply)
+                   int exchange_trusted)
 {
   struct CoinRefund *cr = cls;
 
   cr->fo = NULL;
-  if (TALER_EC_NONE == ec)
+  if (TALER_EC_NONE == hr->ec)
   {
     cr->rh = TALER_EXCHANGE_refund (eh,
                                     &cr->refund_amount,
@@ -363,9 +358,9 @@ exchange_found_cb (void *cls,
                                     cr);
     return;
   }
-  cr->exchange_status = http_status;
-  cr->exchange_code = ec;
-  cr->exchange_reply = json_incref ((json_t*) error_reply);
+  cr->exchange_status = hr->http_status;
+  cr->exchange_code = hr->ec;
+  cr->exchange_reply = json_incref ((json_t*) hr->reply);
   check_resume_prd (cr->prd);
 }
 
diff --git a/src/backend/taler-merchant-httpd_tip-pickup.c 
b/src/backend/taler-merchant-httpd_tip-pickup.c
index cfcbd05..9d90464 100644
--- a/src/backend/taler-merchant-httpd_tip-pickup.c
+++ b/src/backend/taler-merchant-httpd_tip-pickup.c
@@ -73,9 +73,18 @@ struct PickupContext
   /**
    * Placeholder for #TALER_MHD_parse_post_json() to keep its internal state.
    */
-
   void *json_parse_context;
 
+  /**
+   * Kept in a DLL while suspended.
+   */
+  struct PickupContext *next;
+
+  /**
+   * Kept in a DLL while suspended.
+   */
+  struct PickupContext *prev;
+
   /**
    * URL of the exchange this tip uses.
    */
@@ -134,9 +143,44 @@ struct PickupContext
    */
   const char *error_hint;
 
+  /**
+   * Set to #GNUNET_YES if @e connection was suspended.
+   */
+  int suspended;
+
 };
 
 
+/**
+ * Kept in a DLL while suspended.
+ */
+static struct PickupContext *pc_head;
+
+/**
+ * Kept in a DLL while suspended.
+ */
+static struct PickupContext *pc_tail;
+
+
+/**
+ * We are shutting down, force resuming all suspended pickup operations.
+ */
+void
+MH_force_tip_pickup_resume ()
+{
+  struct PickupContext *pc;
+
+  while (NULL != (pc = pc_head))
+  {
+    GNUNET_assert (GNUNET_YES == pc->suspended);
+    GNUNET_CONTAINER_DLL_remove (pc_head,
+                                 pc_tail,
+                                 pc);
+    MHD_resume_connection (pc->connection);
+  }
+}
+
+
 /**
  * Custom cleanup routine for a `struct PickupContext`.
  *
@@ -274,38 +318,36 @@ run_pickup (struct MHD_Connection *connection,
  * operation.
  *
  * @param cls closure with the `struct PickupContext`
+ * @param hr HTTP response details
  * @param eh handle to the exchange context
  * @param wire_fee current applicable wire fee for dealing with @a eh, NULL if 
not available
  * @param exchange_trusted #GNUNET_YES if this exchange is trusted by config
- * @param ec error code, #TALER_EC_NONE on success
- * @param http_status the HTTP status we got from the exchange
- * @param error_reply the full reply from the exchange, NULL if
- *        the response was NOT in JSON or on success
  */
 static void
 exchange_found_cb (void *cls,
+                   const struct TALER_EXCHANGE_HttpResponse *hr,
                    struct TALER_EXCHANGE_Handle *eh,
                    const struct TALER_Amount *wire_fee,
-                   int exchange_trusted,
-                   enum TALER_ErrorCode ec,
-                   unsigned int http_status,
-                   const json_t *error_reply)
+                   int exchange_trusted)
 {
   struct PickupContext *pc = cls;
   const struct TALER_EXCHANGE_Keys *keys;
-  struct GNUNET_HashContext *hc;
   struct TALER_Amount total;
   int ae;
 
   pc->fo = NULL;
+  GNUNET_assert (GNUNET_YES == pc->suspended);
+  GNUNET_CONTAINER_DLL_remove (pc_head,
+                               pc_tail,
+                               pc);
   MHD_resume_connection (pc->connection);
+  TMH_trigger_daemon ();
   if (NULL == eh)
   {
     // FIXME: #6014: forward error details!
     pc->ec = TALER_EC_TIP_PICKUP_EXCHANGE_DOWN;
     pc->error_hint = "failed to contact exchange, check URL";
     pc->response_code = MHD_HTTP_FAILED_DEPENDENCY;
-    TMH_trigger_daemon ();
     return;
   }
   keys = TALER_EXCHANGE_get_keys (eh);
@@ -316,7 +358,6 @@ exchange_found_cb (void *cls,
     pc->error_hint =
       "could not obtain denomination keys from exchange, check URL";
     pc->response_code = MHD_HTTP_FAILED_DEPENDENCY;
-    TMH_trigger_daemon ();
     return;
   }
   GNUNET_assert (0 != pc->planchets_len);
@@ -327,68 +368,70 @@ exchange_found_cb (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Calculating tip amount over %u planchets!\n",
               pc->planchets_len);
-  hc = GNUNET_CRYPTO_hash_context_start ();
-  for (unsigned int i = 0; i<pc->planchets_len; i++)
   {
-    struct PlanchetDetail *pd = &pc->planchets[i];
-    const struct TALER_EXCHANGE_DenomPublicKey *dk;
-    struct TALER_Amount amount_with_fee;
+    struct GNUNET_HashContext *hc;
 
-    dk = TALER_EXCHANGE_get_denomination_key_by_hash (keys,
-                                                      
&pd->wr.h_denomination_pub);
-    if (NULL == dk)
-    {
-      pc->ec = TALER_EC_TIP_PICKUP_EXCHANGE_LACKED_KEY;
-      pc->error_hint = "could not find matching denomination key";
-      pc->response_code = MHD_HTTP_NOT_FOUND;
-      GNUNET_CRYPTO_hash_context_abort (hc);
-      TMH_trigger_daemon ();
-      return;
-    }
-    GNUNET_CRYPTO_hash_context_read (hc,
-                                     &pd->wr.h_denomination_pub,
-                                     sizeof (struct GNUNET_HashCode));
-    GNUNET_CRYPTO_hash_context_read (hc,
-                                     pd->coin_ev,
-                                     pd->coin_ev_size);
-    if (0 >
-        TALER_amount_add (&amount_with_fee,
-                          &dk->value,
-                          &dk->fee_withdraw))
-    {
-      ae = GNUNET_YES;
-    }
-    if (0 == i)
-    {
-      total = amount_with_fee;
-    }
-    else
+    hc = GNUNET_CRYPTO_hash_context_start ();
+    for (unsigned int i = 0; i<pc->planchets_len; i++)
     {
+      struct PlanchetDetail *pd = &pc->planchets[i];
+      const struct TALER_EXCHANGE_DenomPublicKey *dk;
+      struct TALER_Amount amount_with_fee;
+
+      dk = TALER_EXCHANGE_get_denomination_key_by_hash (keys,
+                                                        &pd->wr.
+                                                        h_denomination_pub);
+      if (NULL == dk)
+      {
+        pc->ec = TALER_EC_TIP_PICKUP_EXCHANGE_LACKED_KEY;
+        pc->error_hint = "could not find matching denomination key";
+        pc->response_code = MHD_HTTP_NOT_FOUND;
+        GNUNET_CRYPTO_hash_context_abort (hc);
+        return;
+      }
+      GNUNET_CRYPTO_hash_context_read (hc,
+                                       &pd->wr.h_denomination_pub,
+                                       sizeof (struct GNUNET_HashCode));
+      GNUNET_CRYPTO_hash_context_read (hc,
+                                       pd->coin_ev,
+                                       pd->coin_ev_size);
       if (0 >
-          TALER_amount_add (&total,
-                            &total,
-                            &amount_with_fee))
+          TALER_amount_add (&amount_with_fee,
+                            &dk->value,
+                            &dk->fee_withdraw))
       {
         ae = GNUNET_YES;
       }
+      if (0 == i)
+      {
+        total = amount_with_fee;
+      }
+      else
+      {
+        if (0 >
+            TALER_amount_add (&total,
+                              &total,
+                              &amount_with_fee))
+        {
+          ae = GNUNET_YES;
+        }
+      }
+      TALER_amount_hton (&pd->wr.withdraw_fee,
+                         &dk->fee_withdraw);
+      TALER_amount_hton (&pd->wr.amount_with_fee,
+                         &amount_with_fee);
     }
-    TALER_amount_hton (&pd->wr.withdraw_fee,
-                       &dk->fee_withdraw);
-    TALER_amount_hton (&pd->wr.amount_with_fee,
-                       &amount_with_fee);
+    GNUNET_CRYPTO_hash_context_finish (hc,
+                                       &pc->pickup_id);
   }
-  GNUNET_CRYPTO_hash_context_finish (hc,
-                                     &pc->pickup_id);
   if (GNUNET_YES == ae)
   {
     pc->ec = TALER_EC_TIP_PICKUP_EXCHANGE_AMOUNT_OVERFLOW;
     pc->error_hint = "error computing total value of the tip";
     pc->response_code = MHD_HTTP_BAD_REQUEST;
-    TMH_trigger_daemon ();
     return;
   }
   pc->total = total;
-  TMH_trigger_daemon ();
 }
 
 
@@ -406,6 +449,10 @@ prepare_pickup (struct PickupContext *pc)
   enum GNUNET_DB_QueryStatus qs;
 
   db->preflight (db->cls);
+  /* FIXME: do not pass NULL's, *do* get the
+     data from the DB, we may be able to avoid
+     most of the processing if we already have
+     a valid result! */
   qs = db->lookup_tip_by_id (db->cls,
                              &pc->tip_id,
                              &pc->exchange_url,
@@ -453,6 +500,12 @@ prepare_pickup (struct PickupContext *pc)
                                        TALER_EC_INTERNAL_INVARIANT_FAILURE,
                                        "consult server logs");
   }
+  /* continued asynchronously in exchange_found_cb() */
+  GNUNET_assert (GNUNET_NO == pc->suspended);
+  pc->suspended = GNUNET_YES;
+  GNUNET_CONTAINER_DLL_insert (pc_head,
+                               pc_tail,
+                               pc);
   MHD_suspend_connection (pc->connection);
   return MHD_YES;
 }
diff --git a/src/backend/taler-merchant-httpd_tip-pickup.h 
b/src/backend/taler-merchant-httpd_tip-pickup.h
index 8014042..6fdba31 100644
--- a/src/backend/taler-merchant-httpd_tip-pickup.h
+++ b/src/backend/taler-merchant-httpd_tip-pickup.h
@@ -23,6 +23,14 @@
 #include <microhttpd.h>
 #include "taler-merchant-httpd.h"
 
+
+/**
+ * We are shutting down, force resuming all suspended pickup operations.
+ */
+void
+MH_force_tip_pickup_resume (void);
+
+
 /**
  * Manages a POST /tip-pickup call, checking that the tip is authorized,
  * and if so, returning the withdrawal permissions.
diff --git a/src/backend/taler-merchant-httpd_tip-reserve-helper.c 
b/src/backend/taler-merchant-httpd_tip-reserve-helper.c
index 33ec534..e104e08 100644
--- a/src/backend/taler-merchant-httpd_tip-reserve-helper.c
+++ b/src/backend/taler-merchant-httpd_tip-reserve-helper.c
@@ -331,22 +331,17 @@ handle_status (void *cls,
  * the exchange about the status of the tipping reserve.
  *
  * @param cls closure with a `struct TMH_CheckTipReserve *`
+ * @param hr HTTP response details
  * @param eh handle to the exchange context
  * @param wire_fee current applicable wire fee for dealing with @a eh, NULL if 
not available
  * @param exchange_trusted #GNUNET_YES if this exchange is trusted by config
- * @param ec error code, #TALER_EC_NONE on success
- * @param http_status the HTTP status we got from the exchange
- * @param error_reply the full reply from the exchange, NULL if
- *        the response was NOT in JSON or on success
  */
 static void
 exchange_cont (void *cls,
+               const struct TALER_EXCHANGE_HttpResponse *hr,
                struct TALER_EXCHANGE_Handle *eh,
                const struct TALER_Amount *wire_fee,
-               int exchange_trusted,
-               enum TALER_ErrorCode ec,
-               unsigned int http_status,
-               const json_t *error_reply)
+               int exchange_trusted)
 {
   struct TMH_CheckTipReserve *ctr = cls;
   struct TALER_ReservePublicKeyP reserve_pub;
diff --git a/src/backend/taler-merchant-httpd_track-transaction.c 
b/src/backend/taler-merchant-httpd_track-transaction.c
index 95626fe..39f8ce9 100644
--- a/src/backend/taler-merchant-httpd_track-transaction.c
+++ b/src/backend/taler-merchant-httpd_track-transaction.c
@@ -872,27 +872,23 @@ trace_coins (struct TrackTransactionContext *tctx)
  * tracking the coin.
  *
  * @param cls the `struct TrackTransactionContext`
+ * @param hr HTTP response details
  * @param eh NULL if exchange was not found to be acceptable
  * @param wire_fee NULL (we did not specify a wire method)
  * @param exchange_trusted #GNUNET_YES if this exchange is trusted by config
- * @param ec error code, #TALER_EC_NONE on success
- * @param http_status the HTTP status we got from the exchange
- * @param error_reply the full reply from the exchange, NULL if
- *        the response was NOT in JSON or on success
  */
 static void
 process_track_transaction_with_exchange (void *cls,
+                                         const struct
+                                         TALER_EXCHANGE_HttpResponse *hr,
                                          struct TALER_EXCHANGE_Handle *eh,
                                          const struct TALER_Amount *wire_fee,
-                                         int exchange_trusted,
-                                         enum TALER_ErrorCode ec,
-                                         unsigned int http_status,
-                                         const json_t *error_reply)
+                                         int exchange_trusted)
 {
   struct TrackTransactionContext *tctx = cls;
 
   tctx->fo = NULL;
-  if (MHD_HTTP_OK != http_status)
+  if (MHD_HTTP_OK != hr->http_status)
   {
     /* The request failed somehow */
     GNUNET_break_op (0);
@@ -900,14 +896,14 @@ process_track_transaction_with_exchange (void *cls,
       tctx,
       MHD_HTTP_FAILED_DEPENDENCY,
       TALER_MHD_make_json_pack (
-        (NULL != error_reply)
+        (NULL != hr->reply)
         ? "{s:s, s:I, s:I, s:I, s:O}"
         : "{s:s, s:I, s:I, s:I}",
         "hint", "failed to obtain meta-data from exchange",
         "code", (json_int_t) TALER_EC_TRACK_TRANSACTION_EXCHANGE_KEYS_FAILURE,
-        "exchange_http_status", (json_int_t) http_status,
-        "exchange_code", (json_int_t) ec,
-        "exchange_reply", error_reply));
+        "exchange_http_status", (json_int_t) hr->http_status,
+        "exchange_code", (json_int_t) hr->ec,
+        "exchange_reply", hr->reply));
     return;
   }
   tctx->eh = eh;
diff --git a/src/backend/taler-merchant-httpd_track-transfer.c 
b/src/backend/taler-merchant-httpd_track-transfer.c
index 5c6b383..7f55c91 100644
--- a/src/backend/taler-merchant-httpd_track-transfer.c
+++ b/src/backend/taler-merchant-httpd_track-transfer.c
@@ -795,27 +795,23 @@ wire_transfer_cb (void *cls,
  * Function called with the result of our exchange lookup.
  *
  * @param cls the `struct TrackTransferContext`
+ * @param hr HTTP response details
  * @param eh NULL if exchange was not found to be acceptable
  * @param wire_fee NULL (we did not specify a wire method)
  * @param exchange_trusted #GNUNET_YES if this exchange is trusted by config
- * @param ec error code, #TALER_EC_NONE on success
- * @param http_status the HTTP status we got from the exchange
- * @param error_reply the full reply from the exchange, NULL if
- *        the response was NOT in JSON or on success
  */
 static void
 process_track_transfer_with_exchange (void *cls,
+                                      const struct
+                                      TALER_EXCHANGE_HttpResponse *hr,
                                       struct TALER_EXCHANGE_Handle *eh,
                                       const struct TALER_Amount *wire_fee,
-                                      int exchange_trusted,
-                                      enum TALER_ErrorCode ec,
-                                      unsigned int http_status,
-                                      const json_t *error_reply)
+                                      int exchange_trusted)
 {
   struct TrackTransferContext *rctx = cls;
 
   rctx->fo = NULL;
-  if (MHD_HTTP_OK != http_status)
+  if (MHD_HTTP_OK != hr->http_status)
   {
     /* The request failed somehow */
     GNUNET_break_op (0);
@@ -823,14 +819,14 @@ process_track_transfer_with_exchange (void *cls,
       rctx,
       MHD_HTTP_FAILED_DEPENDENCY,
       TALER_MHD_make_json_pack (
-        (NULL != error_reply)
+        (NULL != hr->reply)
         ? "{s:s, s:I, s:I, s:I, s:O}"
         : "{s:s, s:I, s:I, s:I}",
         "hint", "failed to obtain meta-data from exchange",
         "code", (json_int_t) TALER_EC_TRACK_TRANSFER_EXCHANGE_KEYS_FAILURE,
-        "exchange_http_status", (json_int_t) http_status,
-        "exchange_code", (json_int_t) ec,
-        "exchange_reply", error_reply));
+        "exchange_http_status", (json_int_t) hr->http_status,
+        "exchange_code", (json_int_t) hr->ec,
+        "exchange_reply", hr->reply));
     return;
   }
   rctx->eh = eh;

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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