summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-04-11 00:31:59 +0200
committerChristian Grothoff <christian@grothoff.org>2020-04-11 00:31:59 +0200
commit19c56c7eb81efc272d864d6765d7d61943141ce2 (patch)
treee566702badb4bae31a3d424cbdf523a8e44004d1 /src/backend
parent6d978efe14aa90564ce9257a23bcb2854ba07036 (diff)
downloadmerchant-19c56c7eb81efc272d864d6765d7d61943141ce2.tar.gz
merchant-19c56c7eb81efc272d864d6765d7d61943141ce2.tar.bz2
merchant-19c56c7eb81efc272d864d6765d7d61943141ce2.zip
adding test for #5985
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd.c16
-rw-r--r--src/backend/taler-merchant-httpd_poll-payment.c6
-rw-r--r--src/backend/taler-merchant-httpd_refund_increase.c5
3 files changed, 24 insertions, 3 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 1f9d439e..b86fde71 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -255,6 +255,11 @@ TMH_compute_pay_key (const char *order_id,
GNUNET_CRYPTO_hash (buf,
sizeof (buf),
key);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Pay key for %s is %s\n",
+ order_id,
+ GNUNET_h2s (key));
+
}
@@ -307,6 +312,9 @@ void
TMH_long_poll_suspend (struct TMH_SuspendedConnection *sc,
const struct TALER_Amount *min_refund)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Suspending operation on key %s\n",
+ GNUNET_h2s (&sc->key));
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (payment_trigger_map,
&sc->key,
@@ -353,7 +361,12 @@ resume_operation (void *cls,
( (NULL == have_refund) ||
(1 != TALER_amount_cmp (have_refund,
&sc->refund_expected)) ) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Not awaking client, refund amount of %s not yet satisfied\n",
+ TALER_amount2s (&sc->refund_expected));
return GNUNET_OK; /* skip */
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Resuming operation suspended pending payment on key %s\n",
GNUNET_h2s (key));
@@ -365,6 +378,7 @@ resume_operation (void *cls,
GNUNET_CONTAINER_heap_remove_node (sc->hn));
sc->hn = NULL;
MHD_resume_connection (sc->con);
+ TMH_trigger_daemon ();
return GNUNET_OK;
}
@@ -596,7 +610,7 @@ static int triggered;
* Call MHD to process pending requests and then go back
* and schedule the next run.
*
- * @param cls the `struct MHD_Daemon` of the HTTP server to run
+ * @param cls NULL
*/
static void
run_daemon (void *cls)
diff --git a/src/backend/taler-merchant-httpd_poll-payment.c b/src/backend/taler-merchant-httpd_poll-payment.c
index 49f94896..6ca4fcce 100644
--- a/src/backend/taler-merchant-httpd_poll-payment.c
+++ b/src/backend/taler-merchant-httpd_poll-payment.c
@@ -459,7 +459,6 @@ MH_handler_poll_payment (struct TMH_RequestHandler *rh,
}
} /* end of first-time initialization / sanity checks */
-
db->preflight (db->cls);
/* Check if the order has been paid for. */
@@ -526,6 +525,7 @@ MH_handler_poll_payment (struct TMH_RequestHandler *rh,
/* Accumulate refunds, if any. */
for (unsigned int i = 0; i<MAX_RETRIES; i++)
{
+ pprc->refunded = GNUNET_NO;
qs = db->get_refunds_from_contract_terms_hash (db->cls,
&mi->pubkey,
&pprc->h_contract_terms,
@@ -557,7 +557,9 @@ MH_handler_poll_payment (struct TMH_RequestHandler *rh,
if (0 != remaining.rel_value_us)
{
/* yes, indeed suspend */
- pprc->refunded = GNUNET_NO;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Awaiting refund exceeding %s\n",
+ TALER_amount2s (&pprc->min_refund));
suspend_pprc (pprc);
return MHD_YES;
}
diff --git a/src/backend/taler-merchant-httpd_refund_increase.c b/src/backend/taler-merchant-httpd_refund_increase.c
index 6d49dfc4..5324c619 100644
--- a/src/backend/taler-merchant-httpd_refund_increase.c
+++ b/src/backend/taler-merchant-httpd_refund_increase.c
@@ -258,6 +258,11 @@ process_refund (struct MHD_Connection *connection,
}
/* Resume /public/poll-payments clients that may wait for this refund */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Awakeing clients on %s waiting for refund of less than %s\n",
+ order_id,
+ TALER_amount2s (refund));
+
TMH_long_poll_resume (order_id,
&mi->pubkey,
refund);