comparison src/http/ngx_http_request.c @ 42:41ccba1aba45 NGINX_0_1_21

nginx 0.1.21 *) Bugfix: the ngx_http_stub_status_module showed incorrect statistics if "rtsig" method was used or if several worker process ran on SMP. *) Bugfix: nginx could not be built by the icc compiler on Linux or if the zlib-1.2.x library was building from sources. *) Bugfix: nginx could not be built on NetBSD 2.0.
author Igor Sysoev <http://sysoev.ru>
date Tue, 22 Feb 2005 00:00:00 +0300
parents 2879cd3a40cb
children 4989c3d25945
comparison
equal deleted inserted replaced
41:4d8e7a81b3a0 42:41ccba1aba45
136 if (rev->ready) { 136 if (rev->ready) {
137 /* the deferred accept(), rtsig, aio, iocp */ 137 /* the deferred accept(), rtsig, aio, iocp */
138 138
139 if (ngx_accept_mutex) { 139 if (ngx_accept_mutex) {
140 if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_ERROR) { 140 if (ngx_mutex_lock(ngx_posted_events_mutex) == NGX_ERROR) {
141
141 ngx_http_close_connection(c); 142 ngx_http_close_connection(c);
142 return; 143 return;
143 } 144 }
144 145
145 ngx_post_event(rev); 146 ngx_post_event(rev);
146 147
147 ngx_mutex_unlock(ngx_posted_events_mutex); 148 ngx_mutex_unlock(ngx_posted_events_mutex);
149
150 #if (NGX_STAT_STUB)
151 ngx_atomic_inc(ngx_stat_reading);
152 #endif
148 return; 153 return;
149 } 154 }
150 155
151 #if (NGX_STAT_STUB) 156 #if (NGX_STAT_STUB)
152 (*ngx_stat_reading)++; 157 ngx_atomic_inc(ngx_stat_reading);
153 #endif 158 #endif
154 159
155 ngx_http_init_request(rev); 160 ngx_http_init_request(rev);
156 return; 161 return;
157 } 162 }
174 return; 179 return;
175 } 180 }
176 #endif 181 #endif
177 182
178 #if (NGX_STAT_STUB) 183 #if (NGX_STAT_STUB)
179 (*ngx_stat_reading)++; 184 ngx_atomic_inc(ngx_stat_reading);
180 #endif 185 #endif
181 186
182 } 187 }
183 188
184 189
203 208
204 if (rev->timedout) { 209 if (rev->timedout) {
205 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); 210 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
206 211
207 #if (NGX_STAT_STUB) 212 #if (NGX_STAT_STUB)
208 (*ngx_stat_reading)--; 213 ngx_atomic_dec(ngx_stat_reading);
209 #endif 214 #endif
210 215
211 ngx_http_close_connection(c); 216 ngx_http_close_connection(c);
212 return; 217 return;
213 } 218 }
215 hc = c->data; 220 hc = c->data;
216 221
217 if (hc) { 222 if (hc) {
218 223
219 #if (NGX_STAT_STUB) 224 #if (NGX_STAT_STUB)
220 (*ngx_stat_reading)++; 225 ngx_atomic_inc(ngx_stat_reading);
221 #endif 226 #endif
222 227
223 } else { 228 } else {
224 if (!(hc = ngx_pcalloc(c->pool, sizeof(ngx_http_connection_t)))) { 229 if (!(hc = ngx_pcalloc(c->pool, sizeof(ngx_http_connection_t)))) {
225 230
226 #if (NGX_STAT_STUB) 231 #if (NGX_STAT_STUB)
227 (*ngx_stat_reading)--; 232 ngx_atomic_dec(ngx_stat_reading);
228 #endif 233 #endif
229 234
230 ngx_http_close_connection(c); 235 ngx_http_close_connection(c);
231 return; 236 return;
232 } 237 }
245 250
246 } else { 251 } else {
247 if (!(r = ngx_pcalloc(c->pool, sizeof(ngx_http_request_t)))) { 252 if (!(r = ngx_pcalloc(c->pool, sizeof(ngx_http_request_t)))) {
248 253
249 #if (NGX_STAT_STUB) 254 #if (NGX_STAT_STUB)
250 (*ngx_stat_reading)--; 255 ngx_atomic_dec(ngx_stat_reading);
251 #endif 256 #endif
252 257
253 ngx_http_close_connection(c); 258 ngx_http_close_connection(c);
254 return; 259 return;
255 } 260 }
256 261
257 hc->request = r; 262 hc->request = r;
258 } 263 }
259 264
260 #if (NGX_STAT_STUB) 265 #if (NGX_STAT_STUB)
261 (*ngx_stat_reading)--; 266 ngx_atomic_dec(ngx_stat_reading);
262 #endif 267 #endif
263 268
264 c->data = r; 269 c->data = r;
265 r->http_connection = hc; 270 r->http_connection = hc;
266 271
425 r->headers_out.last_modified_time = -1; 430 r->headers_out.last_modified_time = -1;
426 431
427 r->http_state = NGX_HTTP_READING_REQUEST_STATE; 432 r->http_state = NGX_HTTP_READING_REQUEST_STATE;
428 433
429 #if (NGX_STAT_STUB) 434 #if (NGX_STAT_STUB)
430 (*ngx_stat_reading)++; 435 ngx_atomic_inc(ngx_stat_reading);
431 r->stat_reading = 1; 436 r->stat_reading = 1;
432 (*ngx_stat_requests)++; 437 ngx_atomic_inc(ngx_stat_requests);
433 #endif 438 #endif
434 439
435 rev->event_handler(rev); 440 rev->event_handler(rev);
436 } 441 }
437 442
827 if (rev->timer_set) { 832 if (rev->timer_set) {
828 ngx_del_timer(rev); 833 ngx_del_timer(rev);
829 } 834 }
830 835
831 #if (NGX_STAT_STUB) 836 #if (NGX_STAT_STUB)
832 (*ngx_stat_reading)--; 837 ngx_atomic_dec(ngx_stat_reading);
833 r->stat_reading = 0; 838 r->stat_reading = 0;
834 (*ngx_stat_writing)++; 839 ngx_atomic_inc(ngx_stat_writing);
835 r->stat_writing = 1; 840 r->stat_writing = 1;
836 #endif 841 #endif
837 842
838 rev->event_handler = ngx_http_block_read; 843 rev->event_handler = ngx_http_block_read;
839 ngx_http_handler(r); 844 ngx_http_handler(r);
2074 return; 2079 return;
2075 } 2080 }
2076 2081
2077 #if (NGX_STAT_STUB) 2082 #if (NGX_STAT_STUB)
2078 if (r->stat_reading) { 2083 if (r->stat_reading) {
2079 (*ngx_stat_reading)--; 2084 ngx_atomic_dec(ngx_stat_reading);
2080 } 2085 }
2081 2086
2082 if (r->stat_writing) { 2087 if (r->stat_writing) {
2083 (*ngx_stat_writing)--; 2088 ngx_atomic_dec(ngx_stat_writing);
2084 } 2089 }
2085 #endif 2090 #endif
2086 2091
2087 if (error && r->headers_out.status == 0) { 2092 if (error && r->headers_out.status == 0) {
2088 r->headers_out.status = error; 2093 r->headers_out.status = error;
2201 } 2206 }
2202 2207
2203 #endif 2208 #endif
2204 2209
2205 #if (NGX_STAT_STUB) 2210 #if (NGX_STAT_STUB)
2206 (*ngx_stat_active)--; 2211 ngx_atomic_dec(ngx_stat_active);
2207 #endif 2212 #endif
2208 2213
2209 pool = c->pool; 2214 pool = c->pool;
2210 2215
2211 ngx_close_connection(c); 2216 ngx_close_connection(c);