Author: ru Date: 2013-03-25 13:16:55 +0000 (Mon, 25 Mar 2013) New Revision: 5134 URL: http://trac.nginx.org/nginx/changeset/5134/nginx
Log: Upstream: removed double-free workarounds in peer.free() methods. Modified: trunk/src/http/modules/ngx_http_upstream_keepalive_module.c trunk/src/http/modules/ngx_http_upstream_least_conn_module.c trunk/src/http/ngx_http_upstream_round_robin.c Modified: trunk/src/http/modules/ngx_http_upstream_keepalive_module.c =================================================================== --- trunk/src/http/modules/ngx_http_upstream_keepalive_module.c 2013-03-25 13:14:49 UTC (rev 5133) +++ trunk/src/http/modules/ngx_http_upstream_keepalive_module.c 2013-03-25 13:16:55 UTC (rev 5134) @@ -37,8 +37,6 @@ ngx_event_save_peer_session_pt original_save_session; #endif - ngx_uint_t failed; /* unsigned:1 */ - } ngx_http_upstream_keepalive_peer_data_t; @@ -220,8 +218,6 @@ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0, "get keepalive peer"); - kp->failed = 0; - /* ask balancer */ rc = kp->original_get_peer(pc, kp->data); @@ -282,18 +278,12 @@ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0, "free keepalive peer"); - /* remember failed state - peer.free() may be called more than once */ - - if (state & NGX_PEER_FAILED) { - kp->failed = 1; - } - /* cache valid connections */ u = kp->upstream; c = pc->connection; - if (kp->failed + if (state & NGX_PEER_FAILED || c == NULL || c->read->eof || c->read->error Modified: trunk/src/http/modules/ngx_http_upstream_least_conn_module.c =================================================================== --- trunk/src/http/modules/ngx_http_upstream_least_conn_module.c 2013-03-25 13:14:49 UTC (rev 5133) +++ trunk/src/http/modules/ngx_http_upstream_least_conn_module.c 2013-03-25 13:16:55 UTC (rev 5134) @@ -353,10 +353,6 @@ return; } - if (state == 0 && pc->tries == 0) { - return; - } - lcp->conns[lcp->rrp.current]--; lcp->free_rr_peer(pc, &lcp->rrp, state); Modified: trunk/src/http/ngx_http_upstream_round_robin.c =================================================================== --- trunk/src/http/ngx_http_upstream_round_robin.c 2013-03-25 13:14:49 UTC (rev 5133) +++ trunk/src/http/ngx_http_upstream_round_robin.c 2013-03-25 13:16:55 UTC (rev 5134) @@ -584,10 +584,6 @@ ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0, "free rr peer %ui %ui", pc->tries, state); - if (state == 0 && pc->tries == 0) { - return; - } - /* TODO: NGX_PEER_KEEPALIVE */ if (rrp->peers->single) { _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel