8000 properly honor channel->maxtimeout · c-ares/c-ares@a649c60 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit a649c60

Browse files
committed
properly honor channel->maxtimeout
1 parent 80c2648 commit a649c60

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/lib/ares_metrics.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ size_t ares_metrics_server_timeout(const struct server_state *server,
211211
const ares_channel_t *channel = server->channel;
212212
ares_server_bucket_t i;
213213
size_t timeout_ms = 0;
214-
214+
size_t max_timeout_ms;
215215

216216
for (i = 0; i < ARES_METRIC_COUNT; i++) {
217217
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,
252252
}
253253

254254
/* don't go above upper bounds */
255-
if (channel->maxtimeout && timeout_ms > channel->maxtimeout) {
256-
timeout_ms = channel->maxtimeout;
257-
} else if (timeout_ms > MAX_TIMEOUT_MS) {
258-
timeout_ms = MAX_TIMEOUT_MS;
255+
max_timeout_ms = channel->maxtimeout?channel->maxtimeout:MAX_TIMEOUT_MS;
256+
if (timeout_ms > max_timeout_ms) {
257+
timeout_ms = max_timeout_ms;
259258
}
260259

261260
return timeout_ms;

0 commit comments

Comments
 (0)
0