details: http://hg.nginx.org/nginx/rev/6345822f0abb
branches:
changeset: 6202:6345822f0abb
user: Roman Arutyunyan <arut@nginx.com>
date: Thu Jun 25 12:36:52 2015 +0300
description:
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:
src/stream/ngx_stream_proxy_module.c | 8 +++++---
src/stream/ngx_stream_upstream.h | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)
diffs (53 lines):
diff -r 24488e6db782 -r 6345822f0abb src/stream/ngx_stream_proxy_module.c
--- a/src/stream/ngx_stream_proxy_module.c Tue Jun 23 20:17:48 2015 +0300
+++ b/src/stream/ngx_stream_proxy_module.c Thu Jun 25 12:36:52 2015 +0300
@@ -524,6 +524,8 @@ ngx_stream_proxy_init_upstream(ngx_strea
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_
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_
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_sess
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);
diff -r 24488e6db782 -r 6345822f0abb src/stream/ngx_stream_upstream.h
--- a/src/stream/ngx_stream_upstream.h Tue Jun 23 20:17:48 2015 +0300
+++ b/src/stream/ngx_stream_upstream.h Thu Jun 25 12:36:52 2015 +0300
@@ -87,8 +87,8 @@ typedef struct {
#if (NGX_STREAM_SSL)
ngx_str_t ssl_name;
#endif
- ngx_uint_t proxy_protocol;
- /* unsigned proxy_protocol:1; */
+ unsigned connected:1;
+ unsigned proxy_protocol:1;
} ngx_stream_upstream_t;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel