Added code which checks to see if the user has signalled that tinyproxy
should be closed.
This commit is contained in:
parent
ea0d956a57
commit
388920bc53
@ -1,3 +1,8 @@
|
|||||||
|
2002-01-07 Robert James Kaes <rjkaes@flarenet.com>
|
||||||
|
|
||||||
|
* src/thread.c (thread_main): Added code to check if tinyproxy is
|
||||||
|
being killed by the user.
|
||||||
|
|
||||||
2001-12-28 Robert James Kaes <rjkaes@flarenet.com>
|
2001-12-28 Robert James Kaes <rjkaes@flarenet.com>
|
||||||
|
|
||||||
* src/thread.c (thread_main): Added code to detect errors in the
|
* src/thread.c (thread_main): Added code to detect errors in the
|
||||||
|
21
src/thread.c
21
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
|
* Handles the creation/destruction of the various threads required for
|
||||||
* processing incoming connections.
|
* processing incoming connections.
|
||||||
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the stack frame size used by all the threads. We'll start by
|
* 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)
|
#define THREAD_STACK_SIZE (1024 * 32)
|
||||||
|
|
||||||
@ -128,6 +128,15 @@ thread_main(void *arg)
|
|||||||
clilen = addrlen;
|
clilen = addrlen;
|
||||||
|
|
||||||
pthread_mutex_lock(&mlock);
|
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);
|
connfd = accept(listenfd, cliaddr, &clilen);
|
||||||
pthread_mutex_unlock(&mlock);
|
pthread_mutex_unlock(&mlock);
|
||||||
|
|
||||||
@ -139,7 +148,6 @@ thread_main(void *arg)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ptr->status = T_CONNECTED;
|
ptr->status = T_CONNECTED;
|
||||||
|
|
||||||
SERVER_DEC();
|
SERVER_DEC();
|
||||||
@ -160,9 +168,7 @@ thread_main(void *arg)
|
|||||||
|
|
||||||
ptr->status = T_EMPTY;
|
ptr->status = T_EMPTY;
|
||||||
|
|
||||||
safefree(cliaddr);
|
break;
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,8 +185,7 @@ thread_main(void *arg)
|
|||||||
|
|
||||||
ptr->status = T_EMPTY;
|
ptr->status = T_EMPTY;
|
||||||
|
|
||||||
safefree(cliaddr);
|
break;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
SERVER_UNLOCK();
|
SERVER_UNLOCK();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user