]> git.kaiwu.me - nginx.git/commitdiff
Fixed deferred accept with EPOLLRDHUP enabled (ticket #1278).
authorRoman Arutyunyan <arut@nginx.com>
Wed, 24 May 2017 10:17:08 +0000 (13:17 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Wed, 24 May 2017 10:17:08 +0000 (13:17 +0300)
Previously, the read event of the accepted connection was marked ready, but not
available.  This made EPOLLRDHUP-related code (for example, in ngx_unix_recv())
expect more data from the socket, leading to unexpected behavior.

For example, if SSL, PROXY protocol and deferred accept were enabled on a listen
socket, the client connection was aborted due to unexpected return value of
c->recv().

src/event/ngx_event_accept.c

index 1fce2e89bba16f544c4c71baf4b081231ad1885d..87447d08937ce30fbe64cdcaf4bd48bf0df34958 100644 (file)
@@ -238,7 +238,7 @@ ngx_event_accept(ngx_event_t *ev)
 
         if (ev->deferred_accept) {
             rev->ready = 1;
-#if (NGX_HAVE_KQUEUE)
+#if (NGX_HAVE_KQUEUE || NGX_HAVE_EPOLLRDHUP)
             rev->available = 1;
 #endif
         }