openresty/patches/nginx-1.2.7-run_posted_requ...

47 lines
1.4 KiB
C

diff -ruNp nginx-1.2.7/src/http/ngx_http_upstream.c nginx-1.2.7_zls/src/http/ngx_http_upstream.c
--- nginx-1.2.7/src/http/ngx_http_upstream.c 2013-02-18 23:08:46.000000000 +0800
+++ nginx-1.2.7_zls/src/http/ngx_http_upstream.c 2013-03-13 00:01:01.490582380 +0800
@@ -878,11 +878,13 @@ ngx_http_upstream_cache_send(ngx_http_re
static void
ngx_http_upstream_resolve_handler(ngx_resolver_ctx_t *ctx)
{
+ ngx_connection_t *c;
ngx_http_request_t *r;
ngx_http_upstream_t *u;
ngx_http_upstream_resolved_t *ur;
r = ctx->data;
+ c = r->connection;
u = r->upstream;
ur = u->resolved;
@@ -894,7 +896,8 @@ ngx_http_upstream_resolve_handler(ngx_re
ngx_resolver_strerror(ctx->state));
ngx_http_upstream_finalize_request(r, u, NGX_HTTP_BAD_GATEWAY);
- return;
+
+ goto posted_requests;
}
ur->naddrs = ctx->naddrs;
@@ -919,13 +922,17 @@ ngx_http_upstream_resolve_handler(ngx_re
if (ngx_http_upstream_create_round_robin_peer(r, ur) != NGX_OK) {
ngx_http_upstream_finalize_request(r, u,
NGX_HTTP_INTERNAL_SERVER_ERROR);
- return;
+ goto posted_requests;
}
ngx_resolve_name_done(ctx);
ur->ctx = NULL;
ngx_http_upstream_connect(r, u);
+
+posted_requests:
+
+ ngx_http_run_posted_requests(c);
}