/[hydra]/hydra/src/queue.c
ViewVC logotype

Contents of /hydra/src/queue.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Sat Sep 28 16:32:37 2002 UTC (21 years, 6 months ago) by nmav
Branch: MAIN
CVS Tags: hydra_0_0_3, hydra_0_0_6, hydra_0_0_7, hydra_0_0_4, hydra_0_0_5
Changes since 1.2: +2 -2 lines
File MIME type: text/plain
In sighup and sigterm, the HIC thread is terminated as well.

1 /*
2 * Hydra, an http server
3 * Copyright (C) 1995 Paul Phillips <paulp@go2net.com>
4 * Some changes Copyright (C) 1997 Jon Nelson <jnelson@boa.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 1, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */
21
22 /* $Id: queue.c,v 1.2 2002/09/28 10:05:00 nmav Exp $*/
23
24 #include "boa.h"
25 #include "queue.h"
26
27 /*
28 * Name: block_request
29 *
30 * Description: Moves a request from the ready queue to the blocked queue
31 */
32
33 void block_request(server_params* params, request * req)
34 {
35 dequeue(&params->request_ready, req);
36 enqueue(&params->request_block, req);
37
38 if (req->buffer_end) {
39 BOA_FD_SET(req->fd, &params->block_write_fdset);
40 } else {
41 switch (req->status) {
42 case WRITE:
43 case PIPE_WRITE:
44 case DONE:
45 BOA_FD_SET(req->fd, &params->block_write_fdset);
46 break;
47 case PIPE_READ:
48 BOA_FD_SET(req->data_fd, &params->block_read_fdset);
49 break;
50 case BODY_WRITE:
51 BOA_FD_SET(req->post_data_fd, &params->block_write_fdset);
52 break;
53 default:
54 BOA_FD_SET(req->fd, &params->block_read_fdset);
55 break;
56 }
57 }
58 }
59
60 /*
61 * Name: ready_request
62 *
63 * Description: Moves a request from the blocked queue to the ready queue
64 */
65
66 void ready_request(server_params* params, request * req)
67 {
68 dequeue(&params->request_block, req);
69 enqueue(&params->request_ready, req);
70
71 if (req->buffer_end) {
72 FD_CLR(req->fd, &params->block_write_fdset);
73 } else {
74 switch (req->status) {
75 case WRITE:
76 case PIPE_WRITE:
77 case DONE:
78 FD_CLR(req->fd, &params->block_write_fdset);
79 break;
80 case PIPE_READ:
81 FD_CLR(req->data_fd, &params->block_read_fdset);
82 break;
83 case BODY_WRITE:
84 FD_CLR(req->post_data_fd, &params->block_write_fdset);
85 break;
86 default:
87 FD_CLR(req->fd, &params->block_read_fdset);
88 }
89 }
90 }
91
92
93 /*
94 * Name: dequeue
95 *
96 * Description: Removes a request from its current queue
97 */
98
99 DEQUEUE_FUNCTION( dequeue, request)
100
101 /*
102 * Name: enqueue
103 *
104 * Description: Adds a request to the head of a queue
105 */
106
107 ENQUEUE_FUNCTION( enqueue, request)
108

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26