]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't close idle connections if it takes the active count below min developer/ndptech master
authorNick Porter <nick@portercomputing.co.uk>
Mon, 22 Jun 2026 10:57:05 +0000 (11:57 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Mon, 22 Jun 2026 13:01:42 +0000 (14:01 +0100)
src/lib/server/trunk.c

index a9bf2825c7efbec5a6fbdb7811342b516c594731..918aed5a18235ea374b812d61956851356e9a0ca 100644 (file)
@@ -4237,9 +4237,10 @@ static void trunk_manage(trunk_t *trunk, fr_time_t now)
                        fr_time_lteq(fr_time_add(treq->last_freed, trunk->conf.req_cleanup_delay), now)) talloc_free(treq);
 
        /*
                        fr_time_lteq(fr_time_add(treq->last_freed, trunk->conf.req_cleanup_delay), now)) talloc_free(treq);
 
        /*
-        *      If we have idle connections, then close them.
+        *      If we have idle connections, then close them, maintaining "min" connections.
         */
         */
-       if (fr_time_delta_ispos(trunk->conf.idle_timeout)) {
+       if (fr_time_delta_ispos(trunk->conf.idle_timeout) &&
+           (fr_minmax_heap_num_elements(trunk->active) > trunk->conf.min)) {
                fr_minmax_heap_iter_t   iter;
                fr_time_t idle_cutoff = fr_time_sub(now, trunk->conf.idle_timeout);
 
                fr_minmax_heap_iter_t   iter;
                fr_time_t idle_cutoff = fr_time_sub(now, trunk->conf.idle_timeout);