From 7fe7ee2828d38776d51005cf9750afa819f19c10 Mon Sep 17 00:00:00 2001 From: Robert James Kaes Date: Sun, 26 Aug 2001 21:14:30 +0000 Subject: Fixed a problem where child threads would not be closed if they had been created after the initial creation. Also fixed a problem where the status of the threads were not going back to T_WAITING if MaxRequestsPerChild was 0. --- src/thread.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/thread.c b/src/thread.c index 13de146..4a4704e 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1,4 +1,4 @@ -/* $Id: thread.c,v 1.5 2001-05-27 02:33:35 rjkaes Exp $ +/* $Id: thread.c,v 1.6 2001-08-26 21:14:30 rjkaes Exp $ * * Handles the creation/destruction of the various threads required for * processing incoming connections. @@ -109,12 +109,11 @@ static void *thread_main(void *arg) return NULL; } - for ( ; ; ) { + while (!config.quit) { clilen = addrlen; pthread_mutex_lock(&mlock); connfd = accept(listenfd, cliaddr, &clilen); pthread_mutex_unlock(&mlock); - ptr->status = T_CONNECTED; SERVER_DEC(); @@ -129,13 +128,15 @@ static void *thread_main(void *arg) log_message(LOG_NOTICE, "Thread has reached MaxRequestsPerChild... closing."); ptr->status = T_EMPTY; return NULL; - } else { - ptr->status = T_WAITING; - - SERVER_INC(); } } + + ptr->status = T_WAITING; + + SERVER_INC(); } + + return NULL; } /* -- cgit v1.2.3