]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Suppress messages if thread pool is ~full.
authorAlan T. DeKok <aland@freeradius.org>
Mon, 14 Feb 2011 14:27:40 +0000 (15:27 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 14 Feb 2011 14:27:40 +0000 (15:27 +0100)
If it's full and all threads are buys, we shouldn't try to create spare
threads.

src/main/threads.c

index e0655204cfe56b1783f233668659e115320d2f91..c19101afa06932fbfa1dc7de845392ead313f4f5 100644 (file)
@@ -939,9 +939,14 @@ static void thread_pool_manage(time_t now)
        /*
         *      If there are too few spare threads.  Go create some more.
         */
-       if (spare < thread_pool.min_spare_threads) {
+       if ((thread_pool.total_threads < thread_pool.max_threads) &&
+           (spare < thread_pool.min_spare_threads)) {
                total = thread_pool.min_spare_threads - spare;
 
+               if ((total + thread_pool.total_threads) > thread_pool.max_threads) {
+                       total = thread_pool.max_threads - thread_pool.total_threads;
+               }
+
                DEBUG2("Threads: Spawning %d spares", total);
 
                /*