]> git.kaiwu.me - nginx.git/commit
Improved EPOLLRDHUP handling.
authorValentin Bartenev <vbart@nginx.com>
Fri, 13 May 2016 14:19:23 +0000 (17:19 +0300)
committerValentin Bartenev <vbart@nginx.com>
Fri, 13 May 2016 14:19:23 +0000 (17:19 +0300)
commit12f436718963f8343e38ad6d0e8f7251c95984cd
tree89b72bfa6fd419e2049c5e01d8d4166d3f065b44
parentcbf6ca98bc3f839ab3519ac45807c3c8ae6deb84
Improved EPOLLRDHUP handling.

When it's known that the kernel supports EPOLLRDHUP, there is no need in
additional recv() call to get EOF or error when the flag is absent in the
event generated by the kernel.  A special runtime test is done at startup
to detect if EPOLLRDHUP is actually supported by the kernel because
epoll_ctl() silently ignores unknown flags.

With this knowledge it's now possible to drop the "ready" flag for partial
read.  Previously, the "ready" flag was kept until the recv() returned EOF
or error.  In particular, this change allows the lingering close heuristics
(which relies on the "ready" flag state) to actually work on Linux, and not
wait for more data in most cases.

The "available" flag is now used in the read event with the semantics similar
to the corresponding counter in kqueue.
src/event/modules/ngx_epoll_module.c
src/event/ngx_event.h
src/http/ngx_http_request.c
src/http/ngx_http_upstream.c
src/os/unix/ngx_readv_chain.c
src/os/unix/ngx_recv.c