summaryrefslogtreecommitdiff
path: root/src/lib/merchant_api_poll_payment.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/merchant_api_poll_payment.c')
-rw-r--r--src/lib/merchant_api_poll_payment.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/merchant_api_poll_payment.c b/src/lib/merchant_api_poll_payment.c
index 84da4431..069c5b74 100644
--- a/src/lib/merchant_api_poll_payment.c
+++ b/src/lib/merchant_api_poll_payment.c
@@ -204,6 +204,7 @@ TALER_MERCHANT_poll_payment (struct GNUNET_CURL_Context *ctx,
char *h_contract_s;
char *timeout_s;
unsigned int ts;
+ long tlong;
GNUNET_assert (NULL != backend_url);
GNUNET_assert (NULL != order_id);
@@ -211,6 +212,12 @@ TALER_MERCHANT_poll_payment (struct GNUNET_CURL_Context *ctx,
sizeof (*h_contract));
ts = (unsigned int) (timeout.rel_value_us
/ GNUNET_TIME_UNIT_SECONDS.rel_value_us);
+ /* set curl timeout to *our* long poll timeout plus one minute
+ (for network latency and processing delays) */
+ tlong = (long) (GNUNET_TIME_relative_add (timeout,
+ GNUNET_TIME_UNIT_MINUTES).
+ rel_value_us
+ / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us);
GNUNET_asprintf (&timeout_s,
"%u",
ts);
@@ -236,6 +243,13 @@ TALER_MERCHANT_poll_payment (struct GNUNET_CURL_Context *ctx,
GNUNET_break (0);
return NULL;
}
+ if (CURLE_OK != curl_easy_setopt (eh,
+ CURLOPT_TIMEOUT_MS,
+ tlong))
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"polling payment from %s\n",