aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-23 00:01:09 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-23 00:01:09 +0200
commit51dceb0ed3febf68d80faf0a5ddab6e75b60892d (patch)
treefb6b9f26175dfc050e7d9d9ce11c516f85d12583
parent5335c44f98fb17d5349850219ddd3d3d6695caaa (diff)
-update to match latest exchange APIs
-rw-r--r--src/backend/taler-merchant-httpd.c174
-rw-r--r--src/backend/taler-merchant-httpd.h10
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-abort.c2
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-pay.c2
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-refund.c2
-rw-r--r--src/backend/taler-merchant-httpd_post-tips-ID-pickup.c24
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c2
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders.c4
-rw-r--r--src/backend/taler-merchant-httpd_private-post-reserves.c12
-rw-r--r--src/backend/taler-merchant-httpd_private-post-transfers.c2
-rw-r--r--src/backend/taler-merchant-httpd_reserves.c30
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c2
-rw-r--r--src/include/platform.h25
-rw-r--r--src/testing/testing_api_cmd_post_instances.c2
14 files changed, 99 insertions, 194 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 0492ed96..ea7a6c62 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -24,6 +24,7 @@
#include "platform.h"
#include <taler/taler_dbevents.h>
#include <taler/taler_bank_service.h>
+#include <taler/taler_mhd_lib.h>
#include <taler/taler_exchange_service.h>
#include "taler-merchant-httpd_auditors.h"
#include "taler-merchant-httpd_config.h"
@@ -131,21 +132,11 @@ static uint16_t port;
static int merchant_connection_close;
/**
- * Task running the HTTP server.
- */
-static struct GNUNET_SCHEDULER_Task *mhd_task;
-
-/**
* Global return code
*/
static int result;
/**
- * The MHD Daemon
- */
-static struct MHD_Daemon *mhd;
-
-/**
* MIN-Heap of suspended connections to resume when the timeout expires,
* ordered by timeout. Values are of type `struct MHD_Connection`
*/
@@ -427,7 +418,7 @@ do_resume (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Resuming long polled job due to timeout\n");
MHD_resume_connection (sc->con);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
if (NULL != resume_timeout_task)
GNUNET_SCHEDULER_cancel (resume_timeout_task);
@@ -569,7 +560,7 @@ resume_operation (void *cls,
GNUNET_CONTAINER_heap_remove_node (sc->hn));
sc->hn = NULL;
MHD_resume_connection (sc->con);
- TMH_trigger_daemon ();
+ TALER_MHD_daemon_trigger ();
return GNUNET_OK;
}
@@ -649,7 +640,7 @@ resume_operation2 (void *cls,
GNUNET_CONTAINER_heap_remove_node (sc->hn));
sc->hn = NULL;
MHD_resume_connection (sc->con);
- TMH_trigger_daemon ();
+ TALER_MHD_daemon_trigger ();
return GNUNET_OK;
}
@@ -697,6 +688,7 @@ static void
do_shutdown (void *cls)
{
struct TMH_SuspendedConnection *sc;
+ struct MHD_Daemon *mhd;
(void) cls;
TMH_force_ac_resume ();
@@ -706,11 +698,7 @@ do_shutdown (void *cls)
TMH_force_tip_pickup_resume ();
TMH_force_wallet_get_order_resume ();
TMH_force_wallet_refund_order_resume ();
- if (NULL != mhd_task)
- {
- GNUNET_SCHEDULER_cancel (mhd_task);
- mhd_task = NULL;
- }
+ mhd = TALER_MHD_daemon_stop ();
/* resume all suspended connections, must be done before stopping #mhd */
if (NULL != resume_timeout_heap)
{
@@ -829,108 +817,6 @@ handle_mhd_completion_callback (void *cls,
}
-/**
- * Function that queries MHD's select sets and
- * starts the task waiting for them.
- */
-static struct GNUNET_SCHEDULER_Task *
-prepare_daemon (void);
-
-
-/**
- * Set if we should immediately #MHD_run again.
- */
-static int triggered;
-
-
-/**
- * Call MHD to process pending requests and then go back
- * and schedule the next run.
- *
- * @param cls NULL
- */
-static void
-run_daemon (void *cls)
-{
- mhd_task = NULL;
- do {
- triggered = 0;
- GNUNET_assert (MHD_YES == MHD_run (mhd));
- } while (0 != triggered);
- mhd_task = prepare_daemon ();
-}
-
-
-void
-TMH_trigger_daemon (void)
-{
- if (NULL != mhd_task)
- {
- GNUNET_SCHEDULER_cancel (mhd_task);
- mhd_task = NULL;
- run_daemon (NULL);
- }
- else
- {
- triggered = 1;
- }
-}
-
-
-/**
- * Function that queries MHD's select sets and starts the task waiting for
- * them.
- *
- * @return task handle for the MHD task.
- */
-static struct GNUNET_SCHEDULER_Task *
-prepare_daemon (void)
-{
- struct GNUNET_SCHEDULER_Task *ret;
- fd_set rs;
- fd_set ws;
- fd_set es;
- struct GNUNET_NETWORK_FDSet *wrs;
- struct GNUNET_NETWORK_FDSet *wws;
- int max;
- MHD_UNSIGNED_LONG_LONG timeout;
- int haveto;
- struct GNUNET_TIME_Relative tv;
-
- FD_ZERO (&rs);
- FD_ZERO (&ws);
- FD_ZERO (&es);
- wrs = GNUNET_NETWORK_fdset_create ();
- wws = GNUNET_NETWORK_fdset_create ();
- max = -1;
- GNUNET_assert (MHD_YES ==
- MHD_get_fdset (mhd,
- &rs,
- &ws,
- &es,
- &max));
- haveto = MHD_get_timeout (mhd, &timeout);
- if (haveto == MHD_YES)
- tv = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
- timeout);
- else
- tv = GNUNET_TIME_UNIT_FOREVER_REL;
- GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1);
- GNUNET_NETWORK_fdset_copy_native (wws, &ws, max + 1);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding run_daemon select task\n");
- ret = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
- tv,
- wrs,
- wws,
- &run_daemon,
- NULL);
- GNUNET_NETWORK_fdset_destroy (wrs);
- GNUNET_NETWORK_fdset_destroy (wws);
- return ret;
-}
-
-
struct TMH_MerchantInstance *
TMH_lookup_instance (const char *instance_id)
{
@@ -2345,26 +2231,31 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
- mhd = MHD_start_daemon (MHD_USE_SUSPEND_RESUME | MHD_USE_DUAL_STACK
- | MHD_USE_AUTO,
- port,
- NULL, NULL,
- &url_handler, NULL,
- MHD_OPTION_LISTEN_SOCKET, fh,
- MHD_OPTION_NOTIFY_COMPLETED,
- &handle_mhd_completion_callback, NULL,
- MHD_OPTION_CONNECTION_TIMEOUT,
- (unsigned int) 10 /* 10s */,
- MHD_OPTION_END);
- if (NULL == mhd)
+
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to launch HTTP service. Is the port in use?\n");
- GNUNET_SCHEDULER_shutdown ();
- return;
+ struct MHD_Daemon *mhd;
+
+ mhd = MHD_start_daemon (MHD_USE_SUSPEND_RESUME | MHD_USE_DUAL_STACK
+ | MHD_USE_AUTO,
+ port,
+ NULL, NULL,
+ &url_handler, NULL,
+ MHD_OPTION_LISTEN_SOCKET, fh,
+ MHD_OPTION_NOTIFY_COMPLETED,
+ &handle_mhd_completion_callback, NULL,
+ MHD_OPTION_CONNECTION_TIMEOUT,
+ (unsigned int) 10 /* 10s */,
+ MHD_OPTION_END);
+ if (NULL == mhd)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to launch HTTP service. Is the port in use?\n");
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ result = GNUNET_OK;
+ TALER_MHD_daemon_start (mhd);
}
- result = GNUNET_OK;
- mhd_task = prepare_daemon ();
}
@@ -2395,14 +2286,15 @@ main (int argc,
GNUNET_GETOPT_OPTION_END
};
+ TALER_OS_init ();
res = GNUNET_PROGRAM_run (argc, argv,
"taler-merchant-httpd",
"Taler merchant's HTTP backend interface",
options,
&run, NULL);
if (GNUNET_SYSERR == res)
- return 3;
+ return EXIT_INVALIDARGUMENT;
if (GNUNET_NO == res)
- return 0;
- return (GNUNET_OK == result) ? 0 : 1;
+ return EXIT_SUCCESS;
+ return (GNUNET_OK == result) ? EXIT_SUCCESS : 1;
}
diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h
index 64bd8ad1..474957aa 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -453,16 +453,6 @@ extern char *TMH_default_auth;
/**
- * Kick MHD to run now, to be called after MHD_resume_connection().
- * Basically, we need to explicitly resume MHD's event loop whenever
- * we made progress serving a request. This function re-schedules
- * the task processing MHD's activities to run immediately.
- */
-void
-TMH_trigger_daemon (void);
-
-
-/**
* Suspend connection from @a sc until payment has been received.
*
* @param order_id the order that we are waiting on
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-abort.c b/src/backend/taler-merchant-httpd_post-orders-ID-abort.c
index f0b2a0c2..ce17063e 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-abort.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-abort.c
@@ -310,7 +310,7 @@ resume_abort_with_response (struct AbortContext *ac,
GNUNET_assert (GNUNET_YES == ac->suspended);
ac->suspended = GNUNET_NO;
MHD_resume_connection (ac->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
index 419118b8..f4e7f6ee 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -469,7 +469,7 @@ resume_pay_with_response (struct PayContext *pc,
GNUNET_assert (GNUNET_YES == pc->suspended);
pc->suspended = GNUNET_NO;
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
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 392f70ed..6eeb4182 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
@@ -353,7 +353,7 @@ check_resume_prd (struct PostRefundData *prd)
GNUNET_assert (prd->suspended);
prd->suspended = false;
MHD_resume_connection (prd->sc.con);
- TMH_trigger_daemon ();
+ TALER_MHD_daemon_trigger ();
}
diff --git a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
index 03639f16..99d7957e 100644
--- a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
+++ b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
@@ -297,7 +297,7 @@ withdraw_cb (void *cls,
TALER_JSON_pack_ec (TALER_EC_MERCHANT_TIP_PICKUP_EXCHANGE_ERROR),
TMH_pack_exchange_reply (hr));
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
qs = TMH_db->insert_pickup_blind_signature (TMH_db->cls,
@@ -313,14 +313,14 @@ withdraw_cb (void *cls,
TALER_EC_GENERIC_DB_STORE_FAILED,
"blind signature");
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
if (NULL == pc->po_head)
{
stop_operations (pc); /* stops timeout job */
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
}
@@ -361,7 +361,7 @@ do_withdraw (void *cls,
TALER_JSON_pack_ec (
TALER_EC_MERCHANT_GENERIC_EXCHANGE_TIMEOUT));
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
if (NULL == eh)
@@ -378,7 +378,7 @@ do_withdraw (void *cls,
TALER_EC_MERCHANT_GENERIC_EXCHANGE_CONNECT_FAILURE),
TMH_pack_exchange_reply (hr));
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
po->w2h = TALER_EXCHANGE_withdraw2 (eh,
@@ -442,7 +442,7 @@ do_timeout (void *cls)
TALER_EC_MERCHANT_GENERIC_EXCHANGE_TIMEOUT,
NULL);
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
@@ -479,7 +479,7 @@ compute_total_requested (void *cls,
TALER_JSON_pack_ec (
TALER_EC_MERCHANT_GENERIC_EXCHANGE_TIMEOUT));
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
if (NULL == eh)
@@ -491,7 +491,7 @@ compute_total_requested (void *cls,
TALER_EC_MERCHANT_GENERIC_EXCHANGE_CONNECT_FAILURE),
TMH_pack_exchange_reply (hr));
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
if (NULL == (keys = TALER_EXCHANGE_get_keys (eh)))
@@ -503,7 +503,7 @@ compute_total_requested (void *cls,
TALER_EC_MERCHANT_GENERIC_EXCHANGE_KEYS_FAILURE),
TMH_pack_exchange_reply (hr));
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
GNUNET_assert (GNUNET_OK ==
@@ -525,7 +525,7 @@ compute_total_requested (void *cls,
TALER_EC_MERCHANT_TIP_PICKUP_DENOMINATION_UNKNOWN),
TMH_pack_exchange_reply (hr));
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
@@ -542,13 +542,13 @@ compute_total_requested (void *cls,
TALER_MHD_make_error (TALER_EC_MERCHANT_TIP_PICKUP_SUMMATION_FAILED,
"Could not add up values to compute pickup total");
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
}
pc->tr_initialized = true;
MHD_resume_connection (pc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
index 33976740..e11ce9e9 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -316,7 +316,7 @@ gorc_resume (struct GetOrderRequestContext *gorc,
gorc_tail,
gorc);
MHD_resume_connection (gorc->sc.con);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
diff --git a/src/backend/taler-merchant-httpd_private-get-orders.c b/src/backend/taler-merchant-httpd_private-get-orders.c
index defce83d..0f9e9f13 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders.c
@@ -177,7 +177,7 @@ order_timeout (void *cls)
po);
po->in_dll = false;
MHD_resume_connection (po->con);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
order_timeout_task = GNUNET_SCHEDULER_add_at (po->long_poll_timeout,
&order_timeout,
@@ -452,7 +452,7 @@ TMH_notify_order_change (struct TMH_MerchantInstance *mi,
GNUNET_assert (po ==
GNUNET_CONTAINER_heap_remove_node (po->hn));
MHD_resume_connection (po->con);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
}
diff --git a/src/backend/taler-merchant-httpd_private-post-reserves.c b/src/backend/taler-merchant-httpd_private-post-reserves.c
index c509b9c2..be92b7e4 100644
--- a/src/backend/taler-merchant-httpd_private-post-reserves.c
+++ b/src/backend/taler-merchant-httpd_private-post-reserves.c
@@ -225,14 +225,14 @@ handle_exchange (void *cls,
{
rc->ec = TALER_EC_MERCHANT_GENERIC_EXCHANGE_TIMEOUT;
rc->http_status = MHD_HTTP_GATEWAY_TIMEOUT;
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
if (NULL == eh)
{
rc->ec = TALER_EC_MERCHANT_GENERIC_EXCHANGE_CONNECT_FAILURE;
rc->http_status = MHD_HTTP_BAD_GATEWAY;
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
keys = TALER_EXCHANGE_get_keys (eh);
@@ -240,20 +240,20 @@ handle_exchange (void *cls,
{
rc->ec = TALER_EC_MERCHANT_GENERIC_EXCHANGE_KEYS_FAILURE;
rc->http_status = MHD_HTTP_BAD_GATEWAY;
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
if (NULL == payto_uri)
{
rc->ec = TALER_EC_MERCHANT_PRIVATE_POST_RESERVES_UNSUPPORTED_WIRE_METHOD;
rc->http_status = MHD_HTTP_CONFLICT;
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
return;
}
rc->reserve_expiration
= GNUNET_TIME_relative_to_absolute (keys->reserve_closing_delay);
rc->payto_uri = GNUNET_strdup (payto_uri);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
@@ -282,7 +282,7 @@ handle_exchange_timeout (void *cls)
rc);
rc->ec = TALER_EC_MERCHANT_GENERIC_EXCHANGE_TIMEOUT;
rc->http_status = MHD_HTTP_GATEWAY_TIMEOUT;
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
diff --git a/src/backend/taler-merchant-httpd_private-post-transfers.c b/src/backend/taler-merchant-httpd_private-post-transfers.c
index 1dd5d589..5ae7ac49 100644
--- a/src/backend/taler-merchant-httpd_private-post-transfers.c
+++ b/src/backend/taler-merchant-httpd_private-post-transfers.c
@@ -215,7 +215,7 @@ resume_transfer_with_response (struct PostTransfersContext *ptc,
ptc);
ptc->suspended = false;
MHD_resume_connection (ptc->connection);
- TMH_trigger_daemon (); /* we resumed, kick MHD */
+ TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */
}
diff --git a/src/backend/taler-merchant-httpd_reserves.c b/src/backend/taler-merchant-httpd_reserves.c
index 2853675f..15c03847 100644
--- a/src/backend/taler-merchant-httpd_reserves.c
+++ b/src/backend/taler-merchant-httpd_reserves.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2020 Taler Systems SA
+ (C) 2020, 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
@@ -24,6 +24,14 @@
#include "taler-merchant-httpd_exchanges.h"
#include "taler-merchant-httpd_reserves.h"
+/**
+ * How long do we keep the long-poller open?
+ * Not very long here, as if the money has not
+ * yet arrived, there is a fair chance that it'll
+ * take much longer, and in that case we rather
+ * enter into the delay created by try_later().
+ */
+#define LONGPOLL_DELAY GNUNET_TIME_UNIT_MINUTES
/**
* Our representation of a reserve that we are (still) checking the status of.
@@ -145,6 +153,10 @@ free_reserve (struct Reserve *r)
static void
try_later (struct Reserve *r)
{
+ /* minimum delay is the #LONGPOLL_DELAY */
+ r->delay = GNUNET_TIME_relative_max (LONGPOLL_DELAY,
+ r->delay);
+ /* STD_BACKOFF has a maximum of 15 minutes */
r->delay = GNUNET_TIME_STD_BACKOFF (r->delay);
r->tt = GNUNET_SCHEDULER_add_delayed (r->delay,
&try_now,
@@ -249,6 +261,7 @@ find_cb (void *cls,
}
r->gh = TALER_EXCHANGE_reserves_get (eh,
&r->reserve_pub,
+ LONGPOLL_DELAY,
&reserve_cb,
r);
if (NULL == r->gh)
@@ -316,10 +329,6 @@ add_reserve (void *cls,
}
-/**
- * Load information about reserves and start querying reserve status.
- * Must be called after the database is available.
- */
void
TMH_RESERVES_init (void)
{
@@ -329,14 +338,6 @@ TMH_RESERVES_init (void)
}
-/**
- * Add a reserve to the list of reserves to check.
- *
- * @param instance_id which instance is the reserve for
- * @param exchange_url URL of the exchange with the reserve
- * @param reserve_pub public key of the reserve to check
- * @param expected_amount amount the merchant expects to see initially in the reserve
- */
void
TMH_RESERVES_check (const char *instance_id,
const char *exchange_url,
@@ -351,9 +352,6 @@ TMH_RESERVES_check (const char *instance_id,
}
-/**
- * Stop checking reserve status.
- */
void
TMH_RESERVES_done (void)
{
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 5492785f..5cf38d9b 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -8955,7 +8955,6 @@ postgres_connect (void *cls)
ps);
if (NULL == pg->conn)
return GNUNET_SYSERR;
- GNUNET_PQ_event_scheduler_start (pg->conn);
return GNUNET_OK;
}
@@ -9103,7 +9102,6 @@ libtaler_plugin_merchantdb_postgres_done (void *cls)
if (NULL != pg->conn)
{
- GNUNET_PQ_event_scheduler_stop (pg->conn);
GNUNET_PQ_disconnect (pg->conn);
pg->conn = NULL;
}
diff --git a/src/include/platform.h b/src/include/platform.h
index 89fabb02..39ffa046 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -64,6 +64,31 @@
*/
#define RFC_8959_PREFIX "secret-token:"
+/* LSB-style exit status codes */
+#ifndef EXIT_INVALIDARGUMENT
+#define EXIT_INVALIDARGUMENT 2
+#endif
+
+#ifndef EXIT_NOTIMPLEMENTED
+#define EXIT_NOTIMPLEMENTED 3
+#endif
+
+#ifndef EXIT_NOPERMISSION
+#define EXIT_NOPERMISSION 4
+#endif
+
+#ifndef EXIT_NOTINSTALLED
+#define EXIT_NOTINSTALLED 5
+#endif
+
+#ifndef EXIT_NOTCONFIGURED
+#define EXIT_NOTCONFIGURED 6
+#endif
+
+#ifndef EXIT_NOTRUNNING
+#define EXIT_NOTRUNNING 7
+#endif
+
#endif /* PLATFORM_H_ */
diff --git a/src/testing/testing_api_cmd_post_instances.c b/src/testing/testing_api_cmd_post_instances.c
index 5b133ffd..b2e345bc 100644
--- a/src/testing/testing_api_cmd_post_instances.c
+++ b/src/testing/testing_api_cmd_post_instances.c
@@ -144,6 +144,8 @@ post_instances_cb (void *cls,
{
case MHD_HTTP_NO_CONTENT:
break;
+ case MHD_HTTP_BAD_REQUEST:
+ break;
case MHD_HTTP_UNAUTHORIZED:
break;
case MHD_HTTP_FORBIDDEN: