From: Valentin Bartenev Date: Tue, 3 Mar 2015 14:48:57 +0000 (+0300) Subject: Upstream keepalive: drop ready flag on EAGAIN from recv(MSG_PEEK). X-Git-Tag: release-1.7.11~55 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=2f3fb935b454e7410d98717a33ab1da38d750e7e;p=nginx.git 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. --- diff --git a/src/http/modules/ngx_http_upstream_keepalive_module.c b/src/http/modules/ngx_http_upstream_keepalive_module.c index f738f0cc1..4e005fc0e 100644 --- a/src/http/modules/ngx_http_upstream_keepalive_module.c +++ b/src/http/modules/ngx_http_upstream_keepalive_module.c @@ -387,7 +387,7 @@ ngx_http_upstream_keepalive_close_handler(ngx_event_t *ev) 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;