1 /*
2 
3 kHTTPd -- the next generation
4 
5 logging.c takes care of shutting down a connection.
6 
7 */
8 /****************************************************************
9  *	This program is free software; you can redistribute it and/or modify
10  *	it under the terms of the GNU General Public License as published by
11  *	the Free Software Foundation; either version 2, or (at your option)
12  *	any later version.
13  *
14  *	This program is distributed in the hope that it will be useful,
15  *	but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *	GNU General Public License for more details.
18  *
19  *	You should have received a copy of the GNU General Public License
20  *	along with this program; if not, write to the Free Software
21  *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22  *
23  ****************************************************************/
24 
25 #include <linux/kernel.h>
26 #include <linux/skbuff.h>
27 #include <linux/smp_lock.h>
28 #include <net/tcp.h>
29 #include <asm/uaccess.h>
30 #include "structure.h"
31 #include "prototypes.h"
32 
33 /*
34 
35 Purpose:
36 
37 Logging() terminates "finished" connections and will eventually log them to a
38 userspace daemon.
39 
40 Return value:
41 	The number of requests that changed status, thus the number of connections
42 	that shut down.
43 */
44 
45 
Logging(const int CPUNR)46 int Logging(const int CPUNR)
47 {
48 	struct http_request *CurrentRequest,*Req;
49 	int count = 0;
50 
51 	EnterFunction("Logging");
52 
53 	CurrentRequest = threadinfo[CPUNR].LoggingQueue;
54 
55 	/* For now, all requests are removed immediatly, but this changes
56 	   when userspace-logging is added. */
57 
58 	while (CurrentRequest!=NULL)
59 	{
60 
61 		Req = CurrentRequest->Next;
62 
63 		CleanUpRequest(CurrentRequest);
64 
65 		threadinfo[CPUNR].LoggingQueue = Req;
66 
67 		CurrentRequest = Req;
68 
69 		count++;
70 
71 	}
72 
73 	LeaveFunction("Logging");
74 	return count;
75 }
76 
77 
78 
StopLogging(const int CPUNR)79 void StopLogging(const int CPUNR)
80 {
81 	struct http_request *CurrentRequest,*Next;
82 
83 	EnterFunction("StopLogging");
84 	CurrentRequest = threadinfo[CPUNR].LoggingQueue;
85 
86 	while (CurrentRequest!=NULL)
87 	{
88 		Next=CurrentRequest->Next;
89 		CleanUpRequest(CurrentRequest);
90 		CurrentRequest=Next;
91 	}
92 
93 	threadinfo[CPUNR].LoggingQueue = NULL;
94 	LeaveFunction("StopLogging");
95 }
96