# HG changeset patch # User Valentin Bartenev # Date 1425394137 -10800 # Node ID 4d8936b1fc32943a94c42bb3fbe7e615dbf505df # Parent ea58dfd07782f6968be897b4f712eecf6e03346a 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 --- 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_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;