gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] branch master updated: fix for #6786


From: gnunet
Subject: [taler-merchant] branch master updated: fix for #6786
Date: Fri, 05 Mar 2021 21:47:18 +0100

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 8e540b3b fix for #6786
8e540b3b is described below

commit 8e540b3b516ccc098c40806efd01f3a211044482
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Mar 5 21:47:16 2021 +0100

    fix for #6786
---
 src/backend/taler-merchant-httpd_exchanges.c | 117 +++++++++++++++------------
 1 file changed, 66 insertions(+), 51 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_exchanges.c 
b/src/backend/taler-merchant-httpd_exchanges.c
index 35f51e27..61389fe1 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  (C) 2014-2020 Taler Systems SA
+  (C) 2014-2021 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU Affero General Public License as published by the Free 
Software
@@ -737,6 +737,62 @@ wire_task_cb (void *cls)
 }
 
 
+/**
+ * Free @a exchange.
+ *
+ * @param[in] entry to free
+ */
+static void
+free_exchange_entry (struct Exchange *exchange)
+{
+  struct FeesByWireMethod *f;
+
+  GNUNET_CONTAINER_DLL_remove (exchange_head,
+                               exchange_tail,
+                               exchange);
+  while (NULL != (f = exchange->wire_fees_head))
+  {
+    struct TALER_EXCHANGE_WireAggregateFees *af;
+
+    GNUNET_CONTAINER_DLL_remove (exchange->wire_fees_head,
+                                 exchange->wire_fees_tail,
+                                 f);
+    while (NULL != (af = f->af))
+    {
+      f->af = af->next;
+      GNUNET_free (af);
+    }
+    GNUNET_free (f->wire_method);
+    GNUNET_free (f->payto_uri);
+    GNUNET_free (f);
+  }
+  if (NULL != exchange->wire_request)
+  {
+    TALER_EXCHANGE_wire_cancel (exchange->wire_request);
+    exchange->wire_request = NULL;
+  }
+  if (NULL != exchange->wire_task)
+  {
+    GNUNET_SCHEDULER_cancel (exchange->wire_task);
+    exchange->wire_task = NULL;
+  }
+  if (NULL != exchange->conn)
+  {
+    TALER_EXCHANGE_disconnect (exchange->conn);
+    exchange->conn = NULL;
+  }
+  if (NULL != exchange->retry_task)
+  {
+    GNUNET_SCHEDULER_cancel (exchange->retry_task);
+    exchange->retry_task = NULL;
+  }
+  GNUNET_assert (NULL == exchange->fo_head);
+  GNUNET_assert (NULL == exchange->fo_tail);
+  GNUNET_free (exchange->url);
+  GNUNET_free (exchange);
+}
+
+
 /**
  * We failed downloading /keys from @a exchange. Tell clients
  * about our failure, abort pending operations and retry later.
@@ -785,6 +841,13 @@ fail_and_retry (struct Exchange *exchange,
     exchange->retry_delay = GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_HOURS,
                                                       exchange->retry_delay);
   }
+  if ( (NULL == exchange->fo_head) &&
+       (TALER_EC_GENERIC_CONFIGURATION_INVALID == hr->ec) )
+  {
+    /* This can NEVER work, so don't retry */
+    free_exchange_entry (exchange);
+    return;
+  }
   exchange->retry_delay = RETRY_BACKOFF (exchange->retry_delay);
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
               "Failed to fetch /keys from `%s': %d/%u, retrying in %s\n",
@@ -1230,56 +1293,8 @@ TMH_EXCHANGES_init (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
 void
 TMH_EXCHANGES_done ()
 {
-  struct Exchange *exchange;
-
-  while (NULL != (exchange = exchange_head))
-  {
-    struct FeesByWireMethod *f;
-
-    GNUNET_CONTAINER_DLL_remove (exchange_head,
-                                 exchange_tail,
-                                 exchange);
-    while (NULL != (f = exchange->wire_fees_head))
-    {
-      struct TALER_EXCHANGE_WireAggregateFees *af;
-
-      GNUNET_CONTAINER_DLL_remove (exchange->wire_fees_head,
-                                   exchange->wire_fees_tail,
-                                   f);
-      while (NULL != (af = f->af))
-      {
-        f->af = af->next;
-        GNUNET_free (af);
-      }
-      GNUNET_free (f->wire_method);
-      GNUNET_free (f->payto_uri);
-      GNUNET_free (f);
-    }
-    if (NULL != exchange->wire_request)
-    {
-      TALER_EXCHANGE_wire_cancel (exchange->wire_request);
-      exchange->wire_request = NULL;
-    }
-    if (NULL != exchange->wire_task)
-    {
-      GNUNET_SCHEDULER_cancel (exchange->wire_task);
-      exchange->wire_task = NULL;
-    }
-    if (NULL != exchange->conn)
-    {
-      TALER_EXCHANGE_disconnect (exchange->conn);
-      exchange->conn = NULL;
-    }
-    if (NULL != exchange->retry_task)
-    {
-      GNUNET_SCHEDULER_cancel (exchange->retry_task);
-      exchange->retry_task = NULL;
-    }
-    GNUNET_assert (NULL == exchange->fo_head);
-    GNUNET_assert (NULL == exchange->fo_tail);
-    GNUNET_free (exchange->url);
-    GNUNET_free (exchange);
-  }
+  while (NULL != exchange_head)
+    free_exchange_entry (exchange_head);
   GNUNET_CURL_fini (merchant_curl_ctx);
   merchant_curl_ctx = NULL;
   GNUNET_CURL_gnunet_rc_destroy (merchant_curl_rc);

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