struct http_client_peer_pool *ppool = conn->ppool;
struct http_client *client;
const struct http_client_settings *set;
- unsigned int timeout, count;
peer = conn->peer;
if (peer == NULL) {
array_count(&conn->request_wait_list) == 0 &&
!conn->in_req_callback && conn->incoming_payload == NULL &&
set->max_idle_time_msecs > 0) {
+ unsigned int timeout, count, max;
+
i_assert(peer != NULL);
client = peer->client;
count = array_count(&peer->conns);
i_assert(count > 0);
+ max = set->max_parallel_connections;
+ i_assert(max > 0);
/* Set timeout for this connection */
- if (count > set->max_parallel_connections) {
+ if (count > max) {
/* Instant death for (urgent) connections above limit */
timeout = 0;
} else {
/* Kill duplicate connections quicker;
linearly based on the number of connections */
i_assert(array_count(&ppool->conns) >= idle_count + 1);
- timeout =
- ((set->max_parallel_connections - idle_count) *
- (set->max_idle_time_msecs /
- set->max_parallel_connections));
+ timeout = ((max - idle_count) *
+ (set->max_idle_time_msecs / max));
}
e_debug(conn->event,