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.
This commit is contained in:
Robert James Kaes 2001-08-26 21:14:30 +00:00
parent af10311eaf
commit 7fe7ee2828

View File

@ -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 * Handles the creation/destruction of the various threads required for
* processing incoming connections. * processing incoming connections.
@ -109,12 +109,11 @@ static void *thread_main(void *arg)
return NULL; return NULL;
} }
for ( ; ; ) { while (!config.quit) {
clilen = addrlen; clilen = addrlen;
pthread_mutex_lock(&mlock); pthread_mutex_lock(&mlock);
connfd = accept(listenfd, cliaddr, &clilen); connfd = accept(listenfd, cliaddr, &clilen);
pthread_mutex_unlock(&mlock); pthread_mutex_unlock(&mlock);
ptr->status = T_CONNECTED; ptr->status = T_CONNECTED;
SERVER_DEC(); SERVER_DEC();
@ -129,13 +128,15 @@ static void *thread_main(void *arg)
log_message(LOG_NOTICE, "Thread has reached MaxRequestsPerChild... closing."); log_message(LOG_NOTICE, "Thread has reached MaxRequestsPerChild... closing.");
ptr->status = T_EMPTY; ptr->status = T_EMPTY;
return NULL; return NULL;
} else {
ptr->status = T_WAITING;
SERVER_INC();
} }
} }
ptr->status = T_WAITING;
SERVER_INC();
} }
return NULL;
} }
/* /*