Upstream: limited next_upstream time and tries when resolving DNS.

When got multiple upstream IP addresses using DNS resolving, the number of
upstreams tries and the maxinum time spent for these tries were not affected.
This patch fixed it.