properly honor channel->maxtimeout

pull/816/head
Brad House 5 months ago
parent b1e7cd91cd
commit 6a1e098917
  1. 9
      src/lib/ares_metrics.c

@ -211,7 +211,7 @@ size_t ares_metrics_server_timeout(const struct server_state *server,
const ares_channel_t *channel = server->channel;
ares_server_bucket_t i;
size_t timeout_ms = 0;
size_t max_timeout_ms;
for (i = 0; i < ARES_METRIC_COUNT; i++) {
time_t ts = ares_metric_timestamp(i, now, ARES_FALSE);
@ -252,10 +252,9 @@ size_t ares_metrics_server_timeout(const struct server_state *server,
}
/* don't go above upper bounds */
if (channel->maxtimeout && timeout_ms > channel->maxtimeout) {
timeout_ms = channel->maxtimeout;
} else if (timeout_ms > MAX_TIMEOUT_MS) {
timeout_ms = MAX_TIMEOUT_MS;
max_timeout_ms = channel->maxtimeout?channel->maxtimeout:MAX_TIMEOUT_MS;
if (timeout_ms > max_timeout_ms) {
timeout_ms = max_timeout_ms;
}
return timeout_ms;

Loading…
Cancel
Save