changeset 42:c53e018dbcf5

Keepalive: do not reject connections with ready flag set. Instead, call read event handler explicitly to test if there are actually any unexpected data. This fixes unbuffered proxy connections not being cached with epoll and rtsig event methods.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 08 Sep 2011 17:12:07 +0400
parents 17b2dbbbce98
children d7643c291ef0
files ngx_http_upstream_keepalive_module.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ngx_http_upstream_keepalive_module.c	Sun Sep 04 14:03:11 2011 +0400
+++ b/ngx_http_upstream_keepalive_module.c	Thu Sep 08 17:12:07 2011 +0400
@@ -338,7 +338,6 @@
     if (kp->failed
         || c == NULL
         || c->read->eof
-        || c->read->ready
         || c->read->error
         || c->read->timedout
         || c->write->error
@@ -428,6 +427,10 @@
     item->socklen = pc->socklen;
     ngx_memcpy(&item->sockaddr, pc->sockaddr, pc->socklen);
 
+    if (c->read->ready) {
+        ngx_http_upstream_keepalive_close_handler(c->read);
+    }
+
 invalid:
 
     kp->original_free_peer(pc, kp->data, state);