summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-03-05 21:47:16 +0100
committerChristian Grothoff <christian@grothoff.org>2021-03-05 21:47:16 +0100
commit8e540b3b516ccc098c40806efd01f3a211044482 (patch)
tree5b741614a4b16bff4ec9d2e185b579ce737370ea
parent2cb59820a8715a0fc7d57e9f321d0917aeb0ec03 (diff)
downloadmerchant-8e540b3b516ccc098c40806efd01f3a211044482.tar.gz
merchant-8e540b3b516ccc098c40806efd01f3a211044482.tar.bz2
merchant-8e540b3b516ccc098c40806efd01f3a211044482.zip
fix for #6786
-rw-r--r--src/backend/taler-merchant-httpd_exchanges.c117
1 files 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
@@ -738,6 +738,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);