aboutsummaryrefslogtreecommitdiff
path: root/src/stream/ngx_stream_proxy_module.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2015-06-25 12:36:52 +0300
committerRoman Arutyunyan <arut@nginx.com>2015-06-25 12:36:52 +0300
commitf81ae4e39234526d259d6ecdd62a09cad6f7adce (patch)
tree0578a40a7d68b07c51fd1e30b54393980b297afd /src/stream/ngx_stream_proxy_module.c
parent74942045d5ee7a6955ffb5e1d38e534721b04137 (diff)
downloadnginx-f81ae4e39234526d259d6ecdd62a09cad6f7adce.tar.gz
nginx-f81ae4e39234526d259d6ecdd62a09cad6f7adce.zip
Stream: upstream "connected" flag.
Once upstream is connected, the upstream buffer is allocated. Previously, the proxy module used the buffer allocation status to check if upstream is connected. Now it's enough to check the flag.
Diffstat (limited to 'src/stream/ngx_stream_proxy_module.c')
-rw-r--r--src/stream/ngx_stream_proxy_module.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c
index 10ad7d23c..ebbe02718 100644
--- a/src/stream/ngx_stream_proxy_module.c
+++ b/src/stream/ngx_stream_proxy_module.c
@@ -524,6 +524,8 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)
u->upstream_buf.pos = p;
u->upstream_buf.last = p;
+ u->connected = 1;
+
pc->read->handler = ngx_stream_proxy_upstream_handler;
pc->write->handler = ngx_stream_proxy_upstream_handler;
@@ -870,7 +872,7 @@ ngx_stream_proxy_process_connection(ngx_event_t *ev, ngx_uint_t from_upstream)
return;
}
- if (u->upstream_buf.start) {
+ if (u->connected) {
pc = u->peer.connection;
if (!c->read->delayed && !pc->read->delayed) {
@@ -901,7 +903,7 @@ ngx_stream_proxy_process_connection(ngx_event_t *ev, ngx_uint_t from_upstream)
return;
}
- if (from_upstream && u->upstream_buf.start == NULL) {
+ if (from_upstream && !u->connected) {
return;
}
@@ -1000,7 +1002,7 @@ ngx_stream_proxy_process(ngx_stream_session_t *s, ngx_uint_t from_upstream,
u = s->upstream;
c = s->connection;
- pc = u->upstream_buf.start ? u->peer.connection : NULL;
+ pc = u->connected ? u->peer.connection : NULL;
pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module);