diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2002-01-08 02:02:25 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2002-01-08 02:02:25 +0000 |
commit | 388920bc53a01d983cd438d8ee1f1518f92097ce (patch) | |
tree | 59bb45f2c7eae127f562b4a7306cf3e109046777 /src | |
parent | ea0d956a57f29d0386df62017958a1ae5cc0ec5d (diff) | |
download | tinyproxy-388920bc53a01d983cd438d8ee1f1518f92097ce.tar.gz tinyproxy-388920bc53a01d983cd438d8ee1f1518f92097ce.zip |
Added code which checks to see if the user has signalled that tinyproxy
should be closed.
Diffstat (limited to 'src')
-rw-r--r-- | src/thread.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/thread.c b/src/thread.c index 4ea1bbf..4afd0af 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1,4 +1,4 @@ -/* $Id: thread.c,v 1.19 2001-12-28 22:29:11 rjkaes Exp $ +/* $Id: thread.c,v 1.20 2002-01-08 02:02:25 rjkaes Exp $ * * Handles the creation/destruction of the various threads required for * processing incoming connections. @@ -26,7 +26,7 @@ /* * This is the stack frame size used by all the threads. We'll start by - * setting it to 128 KB. + * setting it to 32 KB. */ #define THREAD_STACK_SIZE (1024 * 32) @@ -128,6 +128,15 @@ thread_main(void *arg) clilen = addrlen; pthread_mutex_lock(&mlock); + + /* + * Check to see if the program is shutting down. + */ + if (config.quit) { + pthread_mutex_unlock(&mlock); + break; + } + connfd = accept(listenfd, cliaddr, &clilen); pthread_mutex_unlock(&mlock); @@ -139,7 +148,6 @@ thread_main(void *arg) continue; } - ptr->status = T_CONNECTED; SERVER_DEC(); @@ -160,9 +168,7 @@ thread_main(void *arg) ptr->status = T_EMPTY; - safefree(cliaddr); - - return NULL; + break; } } @@ -179,8 +185,7 @@ thread_main(void *arg) ptr->status = T_EMPTY; - safefree(cliaddr); - return NULL; + break; } SERVER_UNLOCK(); |