[nginx] Upstream: upstream argument in ngx_http_upstream_process...

Maxim Dounin mdounin at mdounin.ru
Mon Mar 2 19:04:44 UTC 2015


details:   http://hg.nginx.org/nginx/rev/5f179f344096
branches:  
changeset: 5995:5f179f344096
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Mon Mar 02 21:44:42 2015 +0300
description:
Upstream: upstream argument in ngx_http_upstream_process_request().

In case of filter finalization, r->upstream might be changed during
the ngx_event_pipe() call.  Added an argument to preserve it while
calling the ngx_http_upstream_process_request() function.

diffstat:

 src/http/ngx_http_upstream.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (45 lines):

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -76,7 +76,8 @@ static ngx_int_t ngx_http_upstream_non_b
 static void ngx_http_upstream_process_downstream(ngx_http_request_t *r);
 static void ngx_http_upstream_process_upstream(ngx_http_request_t *r,
     ngx_http_upstream_t *u);
-static void ngx_http_upstream_process_request(ngx_http_request_t *r);
+static void ngx_http_upstream_process_request(ngx_http_request_t *r,
+    ngx_http_upstream_t *u);
 static void ngx_http_upstream_store(ngx_http_request_t *r,
     ngx_http_upstream_t *u);
 static void ngx_http_upstream_dummy_handler(ngx_http_request_t *r,
@@ -3349,7 +3350,7 @@ ngx_http_upstream_process_downstream(ngx
         }
     }
 
-    ngx_http_upstream_process_request(r);
+    ngx_http_upstream_process_request(r, u);
 }
 
 
@@ -3417,18 +3418,17 @@ ngx_http_upstream_process_upstream(ngx_h
         }
     }
 
-    ngx_http_upstream_process_request(r);
+    ngx_http_upstream_process_request(r, u);
 }
 
 
 static void
-ngx_http_upstream_process_request(ngx_http_request_t *r)
+ngx_http_upstream_process_request(ngx_http_request_t *r,
+    ngx_http_upstream_t *u)
 {
     ngx_temp_file_t      *tf;
     ngx_event_pipe_t     *p;
-    ngx_http_upstream_t  *u;
-
-    u = r->upstream;
+
     p = u->pipe;
 
     if (u->peer.connection) {



More information about the nginx-devel mailing list