diff --git a/include/haproxy/server.h b/include/haproxy/server.h index 1fa1b2d4d..6ab6c07fa 100644 --- a/include/haproxy/server.h +++ b/include/haproxy/server.h @@ -255,11 +255,11 @@ static inline int srv_add_to_idle_list(struct server *srv, struct connection *co ((srv->proxy->options & PR_O_REUSE_MASK) != PR_O_REUSE_NEVR) && ha_used_fds < global.tune.pool_high_count && (srv->max_idle_conns == -1 || srv->max_idle_conns > srv->curr_idle_conns) && - ((ha_used_fds < global.tune.pool_low_count && - MT_LIST_ISEMPTY(&srv->safe_conns[tid]) && + ((MT_LIST_ISEMPTY(&srv->safe_conns[tid]) && (is_safe || MT_LIST_ISEMPTY(&srv->idle_conns[tid]))) || - (srv->curr_used_conns + srv->curr_idle_conns < - MAX(srv->curr_used_conns, srv->est_need_conns) + global.nbthread)) && + (ha_used_fds < global.tune.pool_low_count && + (srv->curr_used_conns + srv->curr_idle_conns < + MAX(srv->curr_used_conns, srv->est_need_conns) + global.nbthread))) && !conn->mux->used_streams(conn) && conn->mux->avail_streams(conn)) { int retadd;