From: Stephan Bosch Date: Wed, 12 Aug 2020 15:16:12 +0000 (+0200) Subject: lib-http: http-client-connection - Determine idle timeout consistently. X-Git-Tag: 2.3.13~276 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1d65664bfba7253b5b10776e2e9ffa2aa7d7cbe;p=thirdparty%2Fdovecot%2Fcore.git lib-http: http-client-connection - Determine idle timeout consistently. It should not matter whether connection got idle due to lost peer or otherwise. --- diff --git a/src/lib-http/http-client-connection.c b/src/lib-http/http-client-connection.c index fe3525dffe..160cf9f109 100644 --- a/src/lib-http/http-client-connection.c +++ b/src/lib-http/http-client-connection.c @@ -477,6 +477,7 @@ void http_client_connection_check_idle(struct http_client_connection *conn) { struct http_client_peer *peer; struct http_client_peer_pool *ppool = conn->ppool; + struct http_client_peer_shared *pshared = ppool->peer; struct http_client *client; const struct http_client_settings *set; @@ -509,9 +510,9 @@ void http_client_connection_check_idle(struct http_client_connection *conn) if (client->waiting) io_loop_stop(client->ioloop); - count = array_count(&peer->conns); + count = array_count(&ppool->conns); i_assert(count > 0); - max = set->max_parallel_connections; + max = http_client_peer_shared_max_connections(pshared); i_assert(max > 0); /* Set timeout for this connection */ @@ -523,7 +524,7 @@ void http_client_connection_check_idle(struct http_client_connection *conn) /* Kill duplicate connections quicker; linearly based on the number of connections */ - i_assert(array_count(&ppool->conns) >= idle_count + 1); + i_assert(count >= idle_count + 1); timeout = ((max - idle_count) * (set->max_idle_time_msecs / max)); }