summaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_purses_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/exchange_api_purses_get.c')
-rw-r--r--src/lib/exchange_api_purses_get.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/lib/exchange_api_purses_get.c b/src/lib/exchange_api_purses_get.c
index 7a6b2707f..dc22c75ad 100644
--- a/src/lib/exchange_api_purses_get.c
+++ b/src/lib/exchange_api_purses_get.c
@@ -217,6 +217,9 @@ TALER_EXCHANGE_purse_get (
struct TALER_EXCHANGE_PurseGetHandle *pgh;
CURL *eh;
char arg_str[sizeof (*purse_pub) * 2 + 64];
+ unsigned int tms
+ = (unsigned int) timeout.rel_value_us
+ / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us;
pgh = GNUNET_new (struct TALER_EXCHANGE_PurseGetHandle);
pgh->cb = cb;
@@ -233,11 +236,9 @@ TALER_EXCHANGE_purse_get (
*end = '\0';
GNUNET_snprintf (timeout_str,
sizeof (timeout_str),
- "%llu",
- (unsigned long long)
- (timeout.rel_value_us
- / GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us));
- if (GNUNET_TIME_relative_is_zero (timeout))
+ "%u",
+ tms);
+ if (0 == tms)
GNUNET_snprintf (arg_str,
sizeof (arg_str),
"purses/%s/%s",
@@ -267,6 +268,13 @@ TALER_EXCHANGE_purse_get (
GNUNET_free (pgh);
return NULL;
}
+ if (0 != tms)
+ {
+ GNUNET_break (CURLE_OK ==
+ curl_easy_setopt (eh,
+ CURLOPT_TIMEOUT_MS,
+ (long) (tms + 100L)));
+ }
pgh->job = GNUNET_CURL_job_add (ctx,
eh,
&handle_purse_get_finished,