diff src/http/modules/proxy/ngx_http_proxy_upstream.c @ 177:4db54fdbcbe7

nginx-0.0.1-2003-11-10-20:17:31 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 10 Nov 2003 17:17:31 +0000
parents c0552e5ab567
children a8ff48d26cca
line wrap: on
line diff
--- a/src/http/modules/proxy/ngx_http_proxy_upstream.c
+++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c
@@ -305,6 +305,13 @@ static void ngx_http_proxy_reinit_upstre
         }
     }
 
+    /* add one more state */
+
+    if (!(p->state = ngx_push_array(&p->states))) {
+        ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
+        return;
+    }
+
     p->status = 0;
     p->status_count = 0;
 }
@@ -344,6 +351,7 @@ void ngx_http_proxy_upstream_busy_lock(n
         return;
     }
 
+    p->state->status = NGX_HTTP_SERVICE_UNAVAILABLE;
     ngx_http_proxy_finalize_request(p, NGX_HTTP_SERVICE_UNAVAILABLE);
 }
 
@@ -407,11 +415,6 @@ static void ngx_http_proxy_connect(ngx_h
 
     p->request_sent = 0;
 
-    if (!(p->state = ngx_push_array(&p->states))) {
-        ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
-        return;
-    }
-
     if (rc == NGX_AGAIN) {
         ngx_add_timer(c->write, p->lcf->connect_timeout);
         return;
@@ -636,6 +639,7 @@ static void ngx_http_proxy_process_upstr
     /* rc == NGX_OK */
 
     p->upstream->status = p->status;
+    p->state->status = p->status;
 
     if (p->status == NGX_HTTP_INTERNAL_SERVER_ERROR) {