comparison src/http/ngx_http_request.c @ 5103:05a56ebb084a

Respect the new behavior of TCP_DEFER_ACCEPT. In Linux 2.6.32, TCP_DEFER_ACCEPT was changed to accept connections after the deferring period is finished without any data available. (Reading from the socket returns EAGAIN in this case.) Since in nginx TCP_DEFER_ACCEPT is set to "post_accept_timeout", we do not need to wait longer if deferred accept returns with no data.
author Valentin Bartenev <vbart@nginx.com>
date Thu, 07 Mar 2013 17:59:27 +0000
parents f597c9be5c92
children 93713d4b99c3
comparison
equal deleted inserted replaced
5102:f597c9be5c92 5103:05a56ebb084a
414 414
415 n = c->recv(c, b->last, size); 415 n = c->recv(c, b->last, size);
416 416
417 if (n == NGX_AGAIN) { 417 if (n == NGX_AGAIN) {
418 418
419 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
420 if (c->listening->deferred_accept
421 #if (NGX_HTTP_SSL)
422 && c->ssl == NULL
423 #endif
424 )
425 {
426 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
427 "client timed out in deferred accept");
428 ngx_http_close_connection(c);
429 return;
430 }
431 #endif
432
419 if (!rev->timer_set) { 433 if (!rev->timer_set) {
420 ngx_add_timer(rev, c->listening->post_accept_timeout); 434 ngx_add_timer(rev, c->listening->post_accept_timeout);
421 } 435 }
422 436
423 if (ngx_handle_read_event(rev, 0) != NGX_OK) { 437 if (ngx_handle_read_event(rev, 0) != NGX_OK) {
614 628
615 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http recv(): %d", n); 629 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http recv(): %d", n);
616 630
617 if (n == -1) { 631 if (n == -1) {
618 if (err == NGX_EAGAIN) { 632 if (err == NGX_EAGAIN) {
633
634 #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
635 if (c->listening->deferred_accept) {
636 ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
637 "client timed out in deferred accept");
638 ngx_http_close_connection(c);
639 return;
640 }
641 #endif
619 642
620 if (!rev->timer_set) { 643 if (!rev->timer_set) {
621 ngx_add_timer(rev, c->listening->post_accept_timeout); 644 ngx_add_timer(rev, c->listening->post_accept_timeout);
622 } 645 }
623 646