diff -Naur a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c --- a/src/http/ngx_http_upstream.c 2009-12-23 10:31:16.000000000 -0500 +++ b/src/http/ngx_http_upstream.c 2010-01-20 15:26:24.000000000 -0500 @@ -24,8 +24,6 @@ static void ngx_http_upstream_wr_check_broken_connection(ngx_http_request_t *r); static void ngx_http_upstream_check_broken_connection(ngx_http_request_t *r, ngx_event_t *ev); -static void ngx_http_upstream_connect(ngx_http_request_t *r, - ngx_http_upstream_t *u); static ngx_int_t ngx_http_upstream_reinit(ngx_http_request_t *r, ngx_http_upstream_t *u); static void ngx_http_upstream_send_request(ngx_http_request_t *r, @@ -600,13 +598,12 @@ found: - if (uscf->peer.init(r, uscf) != NGX_OK) { - ngx_http_upstream_finalize_request(r, u, - NGX_HTTP_INTERNAL_SERVER_ERROR); - return; + switch(uscf->peer.init(r, uscf)) { + case NGX_OK: ngx_http_upstream_connect(r, u); + case NGX_BUSY: return; } - ngx_http_upstream_connect(r, u); + ngx_http_upstream_finalize_request(r, u, NGX_HTTP_INTERNAL_SERVER_ERROR); } @@ -1030,7 +1027,7 @@ } -static void +void ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) { ngx_int_t rc; diff -Naur a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h --- a/src/http/ngx_http_upstream.h 2009-12-23 09:22:17.000000000 -0500 +++ b/src/http/ngx_http_upstream.h 2010-01-20 15:24:36.000000000 -0500 @@ -321,6 +321,8 @@ ngx_int_t ngx_http_upstream_create(ngx_http_request_t *r); void ngx_http_upstream_init(ngx_http_request_t *r); +#define NGX_HTTP_UPSTREAM_INIT_BUSY_PATCH_VERSION 1 +void ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u); ngx_http_upstream_srv_conf_t *ngx_http_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags); char *ngx_http_upstream_bind_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,