clean the thread pool occasionally.
authoraland <aland>
Tue, 4 Apr 2000 21:12:26 +0000 (21:12 +0000)
committeraland <aland>
Tue, 4 Apr 2000 21:12:26 +0000 (21:12 +0000)
src/include/radiusd.h
src/main/radiusd.c
src/main/threads.c

index 42f47b0..380aa99 100644 (file)
@@ -97,7 +97,7 @@ typedef struct pair_list {
 #define SECONDS_PER_DAY                86400
 #define MAX_REQUEST_TIME       30
 #define CLEANUP_DELAY          5
-#define MAX_REQUESTS           255
+#define MAX_REQUESTS           256
 /* FIXME: these two should be command-line options */
 #define RETRY_DELAY             5
 #define RETRY_COUNT             3
@@ -230,5 +230,5 @@ int            radius_xlat2(char * out, int outlen, char *str,
 #ifdef WITH_THREAD_POOL
 /* threads.c */
 extern         int thread_pool_init(int num_threads);
-extern         int thread_pool_check(void);
+extern         int thread_pool_clean(void);
 #endif
index 603d03a..b4685c8 100644 (file)
@@ -1000,6 +1000,10 @@ static int rad_clean_list(int force)
        DEBUG2("Cleaning up request list after %d seconds",
               (int) (curtime - last_cleaned_list));
        
+#ifdef WITH_THREAD_POOL
+       thread_pool_clean();
+#endif
+
        /*
         *      When mucking around with the request list, we block
         *      asynchronous access (through the SIGCHLD handler) to
@@ -1271,8 +1275,6 @@ static REQUEST *rad_check_list(REQUEST *request)
        }
 #endif 
 
-       max_requests = 255;
-
        /*
         *      Count the total number of requests, to see if there
         *      are too many.  If so, stop counting immediately,
index bba6225..dfa5f5c 100644 (file)
@@ -1,5 +1,7 @@
 #include "autoconf.h"
 
+#ifdef WITH_THREAD_POOL
+
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
@@ -12,7 +14,6 @@
 #  include     <malloc.h>
 #endif
 
-#ifdef WITH_THREAD_POOL
 #include       "radiusd.h"
 
 #ifdef WITH_NEW_CONFIG
@@ -533,7 +534,7 @@ int rad_spawn_child(REQUEST *request, RAD_REQUEST_FUNP fun)
  *     If there are too many or too few threads waiting, then we
  *     either create some more, or delete some.
  */
-int thread_pool_check(void)
+int thread_pool_clean(void)
 {
        int spare;
        int i, total;