Cap spawn at max
authorAlan T. DeKok <aland@freeradius.org>
Wed, 7 May 2014 11:18:40 +0000 (07:18 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 7 May 2014 11:18:40 +0000 (07:18 -0400)
src/main/connection.c

index d17ea3d..737bf7f 100644 (file)
@@ -822,10 +822,15 @@ static int fr_connection_pool_check(fr_connection_pool_t *pool)
        } else if (idle <= pool->spare) {
                /*
                 *      Not enough spare connections.  Spawn a few.
+                *      But cap the pool size at "max"
                 */
                spawn = pool->spare - idle;
                extra = 0;
 
+               if ((pool->num + spawn) > pool->max) {
+                       spawn = pool->max - pool->num;
+               }
+
        } else if ((pool->min + extra) >= pool->num) {
                /*
                 *      If closing the extra connections would take us