comparison src/http/ngx_http_request.c @ 5374:ef3d094bb6d3

Use EPOLLRDHUP in ngx_http_test_reading() (ticket #320). This allows to detect client connection close with pending data when the ngx_http_test_reading() request event handler is set.
author Valentin Bartenev <vbart@nginx.com>
date Mon, 16 Sep 2013 18:33:39 +0400
parents 31af4ae8ad9c
children fdb67cfc957d
comparison
equal deleted inserted replaced
5373:46bdbca10dfc 5374:ef3d094bb6d3
2692 goto closed; 2692 goto closed;
2693 } 2693 }
2694 2694
2695 #endif 2695 #endif
2696 2696
2697 #if (NGX_HAVE_EPOLLRDHUP)
2698
2699 if ((ngx_event_flags & NGX_USE_EPOLL_EVENT) && rev->pending_eof) {
2700 socklen_t len;
2701
2702 rev->eof = 1;
2703 c->error = 1;
2704
2705 err = 0;
2706 len = sizeof(ngx_err_t);
2707
2708 /*
2709 * BSDs and Linux return 0 and set a pending error in err
2710 * Solaris returns -1 and sets errno
2711 */
2712
2713 if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, (void *) &err, &len)
2714 == -1)
2715 {
2716 err = ngx_errno;
2717 }
2718
2719 goto closed;
2720 }
2721
2722 #endif
2723
2697 n = recv(c->fd, buf, 1, MSG_PEEK); 2724 n = recv(c->fd, buf, 1, MSG_PEEK);
2698 2725
2699 if (n == 0) { 2726 if (n == 0) {
2700 rev->eof = 1; 2727 rev->eof = 1;
2701 c->error = 1; 2728 c->error = 1;