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.
This commit is contained in:
Valentin Bartenev 2015-03-03 17:48:57 +03:00
parent b384247262
commit 2f3fb935b4

View File

@ -387,7 +387,7 @@ ngx_http_upstream_keepalive_close_handler(ngx_event_t *ev)
n = recv(c->fd, buf, 1, MSG_PEEK); n = recv(c->fd, buf, 1, MSG_PEEK);
if (n == -1 && ngx_socket_errno == NGX_EAGAIN) { if (n == -1 && ngx_socket_errno == NGX_EAGAIN) {
/* stale event */ ev->ready = 0;
if (ngx_handle_read_event(c->read, 0) != NGX_OK) { if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
goto close; goto close;