only reduce timeout, enable function to be called on existing values

This commit is contained in:
Christian Grothoff 2015-12-19 20:35:41 +01:00
parent 263fd77738
commit 304fc9fb1f

View File

@ -333,15 +333,23 @@ TALER_MINT_get_select_info (struct TALER_MINT_Context *ctx,
int *max_fd, int *max_fd,
long *timeout) long *timeout)
{ {
long to;
GNUNET_assert (CURLM_OK == GNUNET_assert (CURLM_OK ==
curl_multi_fdset (ctx->multi, curl_multi_fdset (ctx->multi,
read_fd_set, read_fd_set,
write_fd_set, write_fd_set,
except_fd_set, except_fd_set,
max_fd)); max_fd));
to = *timeout;
GNUNET_assert (CURLM_OK == GNUNET_assert (CURLM_OK ==
curl_multi_timeout (ctx->multi, 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)) && if ( (-1 == (*timeout)) &&
(NULL != ctx->jobs_head) ) (NULL != ctx->jobs_head) )
*timeout = 1000 * 60 * 5; /* curl is not always good about giving timeouts */ *timeout = 1000 * 60 * 5; /* curl is not always good about giving timeouts */