summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2001-08-26 21:14:30 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2001-08-26 21:14:30 +0000
commit7fe7ee2828d38776d51005cf9750afa819f19c10 (patch)
tree3c9aa02ac1a53833430386673f49392dc13ec814 /src/thread.c
parentaf10311eafd157dab4591d779ad67d51e72a3f08 (diff)
downloadtinyproxy-7fe7ee2828d38776d51005cf9750afa819f19c10.tar.gz
tinyproxy-7fe7ee2828d38776d51005cf9750afa819f19c10.zip
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.
Diffstat (limited to '')
-rw-r--r--src/thread.c15
1 files changed, 8 insertions, 7 deletions
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;
}
/*