From 2f3fb935b454e7410d98717a33ab1da38d750e7e Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Tue, 3 Mar 2015 17:48:57 +0300 Subject: 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. --- src/http/modules/ngx_http_upstream_keepalive_module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit