aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-11-02 17:58:43 +0100
committerChristian Grothoff <christian@grothoff.org>2019-11-02 17:58:43 +0100
commite62708f09ff5a6bd70933be195c538d6751e088f (patch)
tree2f952016baa9c182297d6ac28d388bc411c8b0d6 /src
parent3a22e604af2ca05ab1d1169d5217420fe99d3a7c (diff)
also propage timeout into curl
Diffstat (limited to 'src')
-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",