comparison src/core/ngx_connection.c @ 366:babd3d9efb62 NGINX_0_6_27

nginx 0.6.27 *) Change: now by default the rtsig method is not built on Linux 2.6.18+. *) Change: now a request method is not changed while redirection to a named location via an "error_page" directive. *) Feature: the "resolver" and "resolver_timeout" directives in SMTP proxy. *) Feature: the "post_action" directive supports named locations. *) Bugfix: a segmentation fault occurred in worker process, if a request was redirected from proxy, FastCGI, or memcached location to static named locations. *) Bugfix: browsers did not repeat SSL handshake if there is no valid client certificate in first handshake. Thanks to Alexander V. Inyukhin. *) Bugfix: if response code 495-497 was redirected via an "error_page" directive without code change, then nginx tried to allocate too many memory. *) Bugfix: memory leak in long-lived non buffered connections. *) Bugfix: memory leak in resolver. *) Bugfix: a segmentation fault occurred in worker process, if a request was redirected from proxy, FastCGI, or memcached location to static named locations. *) Bugfix: in the $proxy_host and $proxy_port variables caching. Thanks to Sergey Bochenkov. *) Bugfix: a "proxy_pass" directive with variables used incorrectly the same port as in another "proxy_pass" directive with the same host name and without variables. Thanks to Sergey Bochenkov. *) Bugfix: an alert "sendmsg() failed (9: Bad file descriptor)" on some 64-bit platforms while reconfiguration. *) Bugfix: a segmentation fault occurred in worker process, if empty stub block was used second time in SSI. *) Bugfix: in copying URI part contained escaped symbols into arguments.
author Igor Sysoev <http://sysoev.ru>
date Wed, 12 Mar 2008 00:00:00 +0300
parents a39aab45a53f
children 820f6378fc00
comparison
equal deleted inserted replaced
365:9b0140fa1132 366:babd3d9efb62
659 659
660 660
661 void 661 void
662 ngx_close_connection(ngx_connection_t *c) 662 ngx_close_connection(ngx_connection_t *c)
663 { 663 {
664 ngx_err_t err;
665 ngx_uint_t log_error, level;
664 ngx_socket_t fd; 666 ngx_socket_t fd;
665 667
666 if (c->fd == -1) { 668 if (c->fd == -1) {
667 ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed"); 669 ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed");
668 return; 670 return;
731 c->read->closed = 1; 733 c->read->closed = 1;
732 c->write->closed = 1; 734 c->write->closed = 1;
733 735
734 #endif 736 #endif
735 737
738 log_error = c->log_error;
739
736 ngx_free_connection(c); 740 ngx_free_connection(c);
737 741
738 fd = c->fd; 742 fd = c->fd;
739 c->fd = (ngx_socket_t) -1; 743 c->fd = (ngx_socket_t) -1;
740 744
741 if (ngx_close_socket(fd) == -1) { 745 if (ngx_close_socket(fd) == -1) {
742 746
747 err = ngx_socket_errno;
748
749 if (err == NGX_ECONNRESET || err == NGX_ENOTCONN) {
750
751 switch (log_error) {
752
753 case NGX_ERROR_INFO:
754 level = NGX_LOG_INFO;
755 break;
756
757 case NGX_ERROR_ERR:
758 level = NGX_LOG_ERR;
759 break;
760
761 default:
762 level = NGX_LOG_CRIT;
763 }
764
765 } else {
766 level = NGX_LOG_CRIT;
767 }
768
743 /* we use ngx_cycle->log because c->log was in c->pool */ 769 /* we use ngx_cycle->log because c->log was in c->pool */
744 770
745 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_socket_errno, 771 ngx_log_error(level, ngx_cycle->log, err,
746 ngx_close_socket_n " %d failed", fd); 772 ngx_close_socket_n " %d failed", fd);
747 } 773 }
748 } 774 }
749 775
750 776
782 case NGX_ERROR_ERR: 808 case NGX_ERROR_ERR:
783 level = NGX_LOG_ERR; 809 level = NGX_LOG_ERR;
784 break; 810 break;
785 811
786 default: 812 default:
787 level = NGX_LOG_CRIT; 813 level = NGX_LOG_ALERT;
788 } 814 }
789 815
790 } else { 816 } else {
791 level = NGX_LOG_CRIT; 817 level = NGX_LOG_ALERT;
792 } 818 }
793 819
794 ngx_log_error(level, c->log, err, text); 820 ngx_log_error(level, c->log, err, text);
795 821
796 return NGX_ERROR; 822 return NGX_ERROR;