mirror of
https://github.com/nginx/nginx.git
synced 2024-12-19 21:53:31 -06:00
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.
This commit is contained in:
parent
096678ced4
commit
a11050ea4e
@ -2692,6 +2692,33 @@ ngx_http_test_reading(ngx_http_request_t *r)
|
||||
goto closed;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if (NGX_HAVE_EPOLLRDHUP)
|
||||
|
||||
if ((ngx_event_flags & NGX_USE_EPOLL_EVENT) && rev->pending_eof) {
|
||||
socklen_t len;
|
||||
|
||||
rev->eof = 1;
|
||||
c->error = 1;
|
||||
|
||||
err = 0;
|
||||
len = sizeof(ngx_err_t);
|
||||
|
||||
/*
|
||||
* BSDs and Linux return 0 and set a pending error in err
|
||||
* Solaris returns -1 and sets errno
|
||||
*/
|
||||
|
||||
if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, (void *) &err, &len)
|
||||
== -1)
|
||||
{
|
||||
err = ngx_errno;
|
||||
}
|
||||
|
||||
goto closed;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
n = recv(c->fd, buf, 1, MSG_PEEK);
|
||||
|
Loading…
Reference in New Issue
Block a user