$Log$
+Revision 1.112 1999/12/04 21:56:59 ajc
+* Finished the overhaul. Now to tune...
+
Revision 1.111 1999/12/03 17:59:53 ajc
* BROKEN BUILD. Wrote most of the session removal code, but some of it is
pseudocode so the build is currently broken.
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
-
-
void do_housekeeping(void)
{
- struct wcsession *sptr, *session_to_kill;
+ struct wcsession *sptr, *ss, *session_to_kill;
do {
session_to_kill = NULL;
/* Remove sessions flagged for kill */
if (sptr->killthis) {
- remove session from linked list
+
+ /* remove session from linked list */
+ if (sptr == SessionList) {
+ SessionList = SessionList->next;
+ }
+ else for (ss=SessionList;ss!=NULL;ss=ss->next) {
+ if (ss->next == sptr) {
+ ss->next = ss->next->next;
+ }
+ }
+
session_to_kill = sptr;
goto BREAKOUT;
}
int got_cookie = 0;
struct wcsession *TheSession, *sptr;
- fprintf(stderr, "Reading request from socket %d\n", sock);
-
/*
* Find out what it is that the web browser is asking for
*/
pthread_setspecific(MyConKey, (void *)TheSession);
TheSession->http_sock = sock;
TheSession->lastreq = time(NULL); /* log */
- fprintf(stderr, "Transaction: %s\n", req->line);
+ fprintf(stderr, "%s\n", req->line);
session_loop(req); /* perform the requested transaction */
pthread_mutex_unlock(&TheSession->SessionMutex); /* unbind */
* Now our HTTP connection is done. Close the socket and exit this
* function, so the worker thread can handle a new HTTP connection.
*/
- printf(" Closing socket %d ... ret=%d\n", sock,
- lingering_close(sock));
- return;
+ lingering_close(sock);
}