comparison src/http/ngx_http_request.c @ 110:dad2fe8ecf08 NGINX_0_3_2

nginx 0.3.2 *) Feature: the Sun Studio 10 C compiler support. *) Feature: the "proxy_upstream_max_fails", "proxy_upstream_fail_timeout", "fastcgi_upstream_max_fails", and "fastcgi_upstream_fail_timeout" directives.
author Igor Sysoev <http://sysoev.ru>
date Wed, 12 Oct 2005 00:00:00 +0400
parents 45f7329b4bd0
children 408f195b3482
comparison
equal deleted inserted replaced
109:97da525033a1 110:dad2fe8ecf08
172 ngx_post_event(rev); 172 ngx_post_event(rev);
173 173
174 ngx_mutex_unlock(ngx_posted_events_mutex); 174 ngx_mutex_unlock(ngx_posted_events_mutex);
175 175
176 #if (NGX_STAT_STUB) 176 #if (NGX_STAT_STUB)
177 ngx_atomic_inc(ngx_stat_reading); 177 ngx_atomic_fetch_add(ngx_stat_reading, 1);
178 #endif 178 #endif
179 return; 179 return;
180 } 180 }
181 181
182 #if (NGX_STAT_STUB) 182 #if (NGX_STAT_STUB)
183 ngx_atomic_inc(ngx_stat_reading); 183 ngx_atomic_fetch_add(ngx_stat_reading, 1);
184 #endif 184 #endif
185 185
186 ngx_http_init_request(rev); 186 ngx_http_init_request(rev);
187 return; 187 return;
188 } 188 }
193 ngx_http_close_connection(c); 193 ngx_http_close_connection(c);
194 return; 194 return;
195 } 195 }
196 196
197 #if (NGX_STAT_STUB) 197 #if (NGX_STAT_STUB)
198 ngx_atomic_inc(ngx_stat_reading); 198 ngx_atomic_fetch_add(ngx_stat_reading, 1);
199 #endif 199 #endif
200 200
201 } 201 }
202 202
203 203
224 224
225 if (rev->timedout) { 225 if (rev->timedout) {
226 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); 226 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
227 227
228 #if (NGX_STAT_STUB) 228 #if (NGX_STAT_STUB)
229 ngx_atomic_dec(ngx_stat_reading); 229 ngx_atomic_fetch_add(ngx_stat_reading, -1);
230 #endif 230 #endif
231 231
232 ngx_http_close_connection(c); 232 ngx_http_close_connection(c);
233 return; 233 return;
234 } 234 }
236 hc = c->data; 236 hc = c->data;
237 237
238 if (hc) { 238 if (hc) {
239 239
240 #if (NGX_STAT_STUB) 240 #if (NGX_STAT_STUB)
241 ngx_atomic_inc(ngx_stat_reading); 241 ngx_atomic_fetch_add(ngx_stat_reading, 1);
242 #endif 242 #endif
243 243
244 } else { 244 } else {
245 hc = ngx_pcalloc(c->pool, sizeof(ngx_http_connection_t)); 245 hc = ngx_pcalloc(c->pool, sizeof(ngx_http_connection_t));
246 if (hc == NULL) { 246 if (hc == NULL) {
247 247
248 #if (NGX_STAT_STUB) 248 #if (NGX_STAT_STUB)
249 ngx_atomic_dec(ngx_stat_reading); 249 ngx_atomic_fetch_add(ngx_stat_reading, -1);
250 #endif 250 #endif
251 251
252 ngx_http_close_connection(c); 252 ngx_http_close_connection(c);
253 return; 253 return;
254 } 254 }
268 } else { 268 } else {
269 r = ngx_pcalloc(c->pool, sizeof(ngx_http_request_t)); 269 r = ngx_pcalloc(c->pool, sizeof(ngx_http_request_t));
270 if (r == NULL) { 270 if (r == NULL) {
271 271
272 #if (NGX_STAT_STUB) 272 #if (NGX_STAT_STUB)
273 ngx_atomic_dec(ngx_stat_reading); 273 ngx_atomic_fetch_add(ngx_stat_reading, -1);
274 #endif 274 #endif
275 275
276 ngx_http_close_connection(c); 276 ngx_http_close_connection(c);
277 return; 277 return;
278 } 278 }
279 279
280 hc->request = r; 280 hc->request = r;
281 } 281 }
282 282
283 #if (NGX_STAT_STUB) 283 #if (NGX_STAT_STUB)
284 ngx_atomic_dec(ngx_stat_reading); 284 ngx_atomic_fetch_add(ngx_stat_reading, -1);
285 #endif 285 #endif
286 286
287 c->data = r; 287 c->data = r;
288 r->http_connection = hc; 288 r->http_connection = hc;
289 289
437 ctx = c->log->data; 437 ctx = c->log->data;
438 ctx->request = r; 438 ctx->request = r;
439 r->log_handler = ngx_http_log_error_handler; 439 r->log_handler = ngx_http_log_error_handler;
440 440
441 #if (NGX_STAT_STUB) 441 #if (NGX_STAT_STUB)
442 ngx_atomic_inc(ngx_stat_reading); 442 ngx_atomic_fetch_add(ngx_stat_reading, 1);
443 r->stat_reading = 1; 443 r->stat_reading = 1;
444 ngx_atomic_inc(ngx_stat_requests); 444 ngx_atomic_fetch_add(ngx_stat_requests, 1);
445 #endif 445 #endif
446 446
447 rev->handler(rev); 447 rev->handler(rev);
448 } 448 }
449 449
667 if (rev->timer_set) { 667 if (rev->timer_set) {
668 ngx_del_timer(rev); 668 ngx_del_timer(rev);
669 } 669 }
670 670
671 #if (NGX_STAT_STUB) 671 #if (NGX_STAT_STUB)
672 ngx_atomic_dec(ngx_stat_reading); 672 ngx_atomic_fetch_add(ngx_stat_reading, -1);
673 r->stat_reading = 0; 673 r->stat_reading = 0;
674 ngx_atomic_inc(ngx_stat_writing); 674 ngx_atomic_fetch_add(ngx_stat_writing, 1);
675 r->stat_writing = 1; 675 r->stat_writing = 1;
676 #endif 676 #endif
677 677
678 rev->handler = ngx_http_request_handler; 678 rev->handler = ngx_http_request_handler;
679 c->write->handler = ngx_http_request_handler; 679 c->write->handler = ngx_http_request_handler;
897 if (rev->timer_set) { 897 if (rev->timer_set) {
898 ngx_del_timer(rev); 898 ngx_del_timer(rev);
899 } 899 }
900 900
901 #if (NGX_STAT_STUB) 901 #if (NGX_STAT_STUB)
902 ngx_atomic_dec(ngx_stat_reading); 902 ngx_atomic_fetch_add(ngx_stat_reading, -1);
903 r->stat_reading = 0; 903 r->stat_reading = 0;
904 ngx_atomic_inc(ngx_stat_writing); 904 ngx_atomic_fetch_add(ngx_stat_writing, 1);
905 r->stat_writing = 1; 905 r->stat_writing = 1;
906 #endif 906 #endif
907 907
908 rev->handler = ngx_http_request_handler; 908 rev->handler = ngx_http_request_handler;
909 c->write->handler = ngx_http_request_handler; 909 c->write->handler = ngx_http_request_handler;
2394 return; 2394 return;
2395 } 2395 }
2396 2396
2397 #if (NGX_STAT_STUB) 2397 #if (NGX_STAT_STUB)
2398 if (r->stat_reading) { 2398 if (r->stat_reading) {
2399 ngx_atomic_dec(ngx_stat_reading); 2399 ngx_atomic_fetch_add(ngx_stat_reading, -1);
2400 } 2400 }
2401 2401
2402 if (r->stat_writing) { 2402 if (r->stat_writing) {
2403 ngx_atomic_dec(ngx_stat_writing); 2403 ngx_atomic_fetch_add(ngx_stat_writing, -1);
2404 } 2404 }
2405 #endif 2405 #endif
2406 2406
2407 if (error && r->headers_out.status == 0) { 2407 if (error && r->headers_out.status == 0) {
2408 r->headers_out.status = error; 2408 r->headers_out.status = error;
2455 } 2455 }
2456 2456
2457 #endif 2457 #endif
2458 2458
2459 #if (NGX_STAT_STUB) 2459 #if (NGX_STAT_STUB)
2460 ngx_atomic_dec(ngx_stat_active); 2460 ngx_atomic_fetch_add(ngx_stat_active, -1);
2461 #endif 2461 #endif
2462 2462
2463 pool = c->pool; 2463 pool = c->pool;
2464 2464
2465 ngx_close_connection(c); 2465 ngx_close_connection(c);