aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mint-lib/mint_api_context.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mint-lib/mint_api_context.c b/src/mint-lib/mint_api_context.c
index 4ab46e4ee..be3df7c21 100644
--- 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 */