summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-post-orders.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-10-29 16:07:09 +0100
committerChristian Grothoff <christian@grothoff.org>2023-10-29 16:07:09 +0100
commit2f4844d1e33399ee7d1ac642f0b0f66885c3cfb5 (patch)
treebd3a5461112b27c3d901b67590f3f3646b5b113c /src/backend/taler-merchant-httpd_private-post-orders.c
parent9da968d394083339ce3125b4f619dfdf3e776ca9 (diff)
downloadmerchant-2f4844d1e33399ee7d1ac642f0b0f66885c3cfb5.tar.gz
merchant-2f4844d1e33399ee7d1ac642f0b0f66885c3cfb5.tar.bz2
merchant-2f4844d1e33399ee7d1ac642f0b0f66885c3cfb5.zip
work on #7965: better exchange /keys handling
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-orders.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders.c57
1 files changed, 11 insertions, 46 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
index 7d9bc4f0..d46bfa85 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -39,11 +39,6 @@
#define MAX_RETRIES 3
/**
- * How long do we wait for /keys from the exchange?
- */
-#define KEYS_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
-
-/**
* What is the label under which we find/place the merchant's
* jurisdiction in the locations list by default?
*/
@@ -129,11 +124,6 @@ struct RekeyExchange
*/
struct TMH_EXCHANGES_KeysOperation *fo;
- /**
- * Timeout task handle.
- */
- struct GNUNET_SCHEDULER_Task *tx;
-
};
@@ -429,7 +419,6 @@ clean_order (void *cls)
oc->pending_reload_tail,
rx);
TMH_EXCHANGES_keys4exchange_cancel (rx->fo);
- GNUNET_SCHEDULER_cancel (rx->tx);
GNUNET_free (rx->url);
GNUNET_free (rx);
}
@@ -941,6 +930,10 @@ get_acceptable (void *cls,
res = TMH_exchange_check_debit (exchange,
oc->wm);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Exchange %s evaluated at %d\n",
+ url,
+ res);
switch (res)
{
case GNUNET_OK:
@@ -1016,8 +1009,6 @@ keys_cb (
&oc->hc->instance->settings;
rx->fo = NULL;
- GNUNET_SCHEDULER_cancel (rx->tx);
- rx->tx = NULL;
GNUNET_CONTAINER_DLL_remove (oc->pending_reload_head,
oc->pending_reload_tail,
rx);
@@ -1029,6 +1020,9 @@ keys_cb (
}
else
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Got response for %skeys\n",
+ rx->url);
if ( (settings->use_stefan) &&
(GNUNET_OK !=
TALER_amount_is_valid (&oc->max_fee)) )
@@ -1047,32 +1041,6 @@ keys_cb (
/**
- * A `/keys` request to an exchange is taking too
- * long, ignore the exchange for now.
- *
- * @param cls a `struct RekeyExchange *`
- */
-static void
-keys_timeout (void *cls)
-{
- struct RekeyExchange *rx = cls;
- struct OrderContext *oc = rx->oc;
-
- rx->tx = NULL;
- TMH_EXCHANGES_keys4exchange_cancel (rx->fo);
- rx->fo = NULL;
- GNUNET_CONTAINER_DLL_remove (oc->pending_reload_head,
- oc->pending_reload_tail,
- rx);
- GNUNET_free (rx->url);
- GNUNET_free (rx);
- if (NULL != oc->pending_reload_head)
- return;
- resume_with_keys (oc);
-}
-
-
-/**
* Force re-downloading of /keys from @a exchange,
* we currently have no acceptable exchange, so we
* should try to get one.
@@ -1095,17 +1063,14 @@ get_exchange_keys (void *cls,
GNUNET_CONTAINER_DLL_insert (oc->pending_reload_head,
oc->pending_reload_tail,
rx);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Forcing download of %s/keys\n",
- url);
+ if (oc->forced_reload)
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Forcing download of %skeys\n",
+ url);
rx->fo = TMH_EXCHANGES_keys4exchange (url,
oc->forced_reload,
&keys_cb,
rx);
- rx->tx
- = GNUNET_SCHEDULER_add_delayed (KEYS_TIMEOUT,
- &keys_timeout,
- rx);
}