# HG changeset patch # User Maxim Dounin # Date 1311670274 -14400 # Node ID cb15f6f4d82061e368e9ae356e1ba73da0f90fef # Parent c6396fef9295c379dddb8cc5a045c46e1861ff27 Keepalive: don't cache timed out connections. diff --git a/ngx_http_upstream_keepalive_module.c b/ngx_http_upstream_keepalive_module.c --- a/ngx_http_upstream_keepalive_module.c +++ b/ngx_http_upstream_keepalive_module.c @@ -309,10 +309,13 @@ ngx_http_upstream_free_keepalive_peer(ng */ u = kp->upstream; + c = pc->connection; status = u->headers_in.status_n; if (!kp->failed - && pc->connection != NULL + && c != NULL + && !c->read->timedout + && !c->write->timedout #if (NGX_UPSTREAM_KEEPALIVE_PATCHED) && u->keepalive) #else @@ -320,8 +323,6 @@ ngx_http_upstream_free_keepalive_peer(ng || (status == NGX_HTTP_OK && u->header_sent && u->length == 0))) #endif { - c = pc->connection; - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, "free keepalive peer: saving connection %p", c);