commit 304fc9fb1fa908158c2795a69be102598af272cb
parent 263fd77738a8b1749ecac0748328a72bdee4a5b5
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 19 Dec 2015 20:35:41 +0100
only reduce timeout, enable function to be called on existing values
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/mint-lib/mint_api_context.c b/src/mint-lib/mint_api_context.c
@@ -333,15 +333,23 @@ TALER_MINT_get_select_info (struct TALER_MINT_Context *ctx,
int *max_fd,
long *timeout)
{
+ long to;
+
GNUNET_assert (CURLM_OK ==
curl_multi_fdset (ctx->multi,
read_fd_set,
write_fd_set,
except_fd_set,
max_fd));
+ to = *timeout;
GNUNET_assert (CURLM_OK ==
curl_multi_timeout (ctx->multi,
- timeout));
+ &to));
+ /* Only if what we got back from curl is smaller than what we
+ already had (-1 == infinity!), then update timeout */
+ if ( (to < *timeout) &&
+ (-1 != to) )
+ *timeout = to;
if ( (-1 == (*timeout)) &&
(NULL != ctx->jobs_head) )
*timeout = 1000 * 60 * 5; /* curl is not always good about giving timeouts */