Fix constraints on curl_fetch_timeout option.

5 <= n <= 60 seconds.
This commit is contained in:
Michael Drake 2016-02-15 09:55:57 +00:00
parent 3b57ce1013
commit c207216fa2

View File

@ -189,9 +189,9 @@ static void nsoption_validate(struct nsoption_s *opts, struct nsoption_s *defs)
if (opts[NSOPTION_max_retried_fetches].value.u == 0)
opts[NSOPTION_max_retried_fetches].value.u = 1;
if (opts[NSOPTION_curl_fetch_timeout].value.u < 5)
opts[NSOPTION_max_retried_fetches].value.u = 5;
opts[NSOPTION_curl_fetch_timeout].value.u = 5;
if (opts[NSOPTION_curl_fetch_timeout].value.u > 60)
opts[NSOPTION_max_retried_fetches].value.u = 60;
opts[NSOPTION_curl_fetch_timeout].value.u = 60;
while ((opts[NSOPTION_curl_fetch_timeout].value.u *
opts[NSOPTION_max_retried_fetches].value.u) > 60)
opts[NSOPTION_max_retried_fetches].value.u--;