[nginx] Upstream keepalive: drop ready flag on EAGAIN from recv(...

Valentin Bartenev vbart at nginx.com
Tue Mar 3 15:46:43 UTC 2015


details:   http://hg.nginx.org/nginx/rev/4d8936b1fc32
branches:  
changeset: 5999:4d8936b1fc32
user:      Valentin Bartenev <vbart at nginx.com>
date:      Tue Mar 03 17:48:57 2015 +0300
description:
Upstream keepalive: drop ready flag on EAGAIN from recv(MSG_PEEK).

Keeping the ready flag in this case might results in missing notification of
broken connection until nginx tried to use it again.

While there, stale comment about stale event was removed since this function
is also can be called directly.

diffstat:

 src/http/modules/ngx_http_upstream_keepalive_module.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r ea58dfd07782 -r 4d8936b1fc32 src/http/modules/ngx_http_upstream_keepalive_module.c
--- a/src/http/modules/ngx_http_upstream_keepalive_module.c	Tue Mar 03 18:09:13 2015 +0300
+++ b/src/http/modules/ngx_http_upstream_keepalive_module.c	Tue Mar 03 17:48:57 2015 +0300
@@ -387,7 +387,7 @@ ngx_http_upstream_keepalive_close_handle
     n = recv(c->fd, buf, 1, MSG_PEEK);
 
     if (n == -1 && ngx_socket_errno == NGX_EAGAIN) {
-        /* stale event */
+        ev->ready = 0;
 
         if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
             goto close;



More information about the nginx-devel mailing list