comparison src/http/ngx_http_request.c @ 5090:9db95b275755

Status: do not count connection as reading right after accept(). Before we receive the first bytes, the connection is counted as waiting. This change simplifies further code changes.
author Valentin Bartenev <vbart@nginx.com>
date Wed, 27 Feb 2013 17:16:51 +0000
parents 903f2a5d86a5
children d3e256c67d6d
comparison
equal deleted inserted replaced
5089:903f2a5d86a5 5090:9db95b275755
314 314
315 rev = c->read; 315 rev = c->read;
316 rev->handler = ngx_http_init_request; 316 rev->handler = ngx_http_init_request;
317 c->write->handler = ngx_http_empty_handler; 317 c->write->handler = ngx_http_empty_handler;
318 318
319 #if (NGX_STAT_STUB)
320 (void) ngx_atomic_fetch_add(ngx_stat_reading, 1);
321 #endif
322
323 if (rev->ready) { 319 if (rev->ready) {
324 /* the deferred accept(), rtsig, aio, iocp */ 320 /* the deferred accept(), rtsig, aio, iocp */
325 321
326 if (ngx_use_accept_mutex) { 322 if (ngx_use_accept_mutex) {
327 ngx_post_event(rev, &ngx_posted_events); 323 ngx_post_event(rev, &ngx_posted_events);
333 } 329 }
334 330
335 ngx_add_timer(rev, c->listening->post_accept_timeout); 331 ngx_add_timer(rev, c->listening->post_accept_timeout);
336 332
337 if (ngx_handle_read_event(rev, 0) != NGX_OK) { 333 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
338 #if (NGX_STAT_STUB)
339 (void) ngx_atomic_fetch_add(ngx_stat_reading, -1);
340 #endif
341 ngx_http_close_connection(c); 334 ngx_http_close_connection(c);
342 return; 335 return;
343 } 336 }
344 } 337 }
345 338
353 ngx_http_log_ctx_t *ctx; 346 ngx_http_log_ctx_t *ctx;
354 ngx_http_connection_t *hc; 347 ngx_http_connection_t *hc;
355 ngx_http_core_srv_conf_t *cscf; 348 ngx_http_core_srv_conf_t *cscf;
356 ngx_http_core_loc_conf_t *clcf; 349 ngx_http_core_loc_conf_t *clcf;
357 ngx_http_core_main_conf_t *cmcf; 350 ngx_http_core_main_conf_t *cmcf;
358
359 #if (NGX_STAT_STUB)
360 (void) ngx_atomic_fetch_add(ngx_stat_reading, -1);
361 #endif
362 351
363 c = rev->data; 352 c = rev->data;
364 353
365 if (rev->timedout) { 354 if (rev->timedout) {
366 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); 355 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
2611 2600
2612 if (b->pos < b->last) { 2601 if (b->pos < b->last) {
2613 2602
2614 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request"); 2603 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request");
2615 2604
2616 #if (NGX_STAT_STUB)
2617 (void) ngx_atomic_fetch_add(ngx_stat_reading, 1);
2618 #endif
2619
2620 hc->pipeline = 1; 2605 hc->pipeline = 1;
2621 c->log->action = "reading client pipelined request line"; 2606 c->log->action = "reading client pipelined request line";
2622 2607
2623 rev->handler = ngx_http_init_request; 2608 rev->handler = ngx_http_init_request;
2624 ngx_post_event(rev, &ngx_posted_events); 2609 ngx_post_event(rev, &ngx_posted_events);
2857 return; 2842 return;
2858 } 2843 }
2859 2844
2860 b->last += n; 2845 b->last += n;
2861 2846
2862 #if (NGX_STAT_STUB)
2863 (void) ngx_atomic_fetch_add(ngx_stat_reading, 1);
2864 #endif
2865
2866 c->log->handler = ngx_http_log_error; 2847 c->log->handler = ngx_http_log_error;
2867 c->log->action = "reading client request line"; 2848 c->log->action = "reading client request line";
2868 2849
2869 c->idle = 0; 2850 c->idle = 0;
2870 ngx_reusable_connection(c, 0); 2851 ngx_reusable_connection(c, 0);