Mercurial > hg > nginx-quic
comparison src/stream/ngx_stream_proxy_module.c @ 6202:6345822f0abb
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.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 25 Jun 2015 12:36:52 +0300 |
parents | 24488e6db782 |
children | fdfdcad62875 |
comparison
equal
deleted
inserted
replaced
6201:24488e6db782 | 6202:6345822f0abb |
---|---|
522 u->upstream_buf.start = p; | 522 u->upstream_buf.start = p; |
523 u->upstream_buf.end = p + pscf->upstream_buf_size; | 523 u->upstream_buf.end = p + pscf->upstream_buf_size; |
524 u->upstream_buf.pos = p; | 524 u->upstream_buf.pos = p; |
525 u->upstream_buf.last = p; | 525 u->upstream_buf.last = p; |
526 | 526 |
527 u->connected = 1; | |
528 | |
527 pc->read->handler = ngx_stream_proxy_upstream_handler; | 529 pc->read->handler = ngx_stream_proxy_upstream_handler; |
528 pc->write->handler = ngx_stream_proxy_upstream_handler; | 530 pc->write->handler = ngx_stream_proxy_upstream_handler; |
529 | 531 |
530 if (ngx_stream_proxy_process(s, 1, 0) != NGX_OK) { | 532 if (ngx_stream_proxy_process(s, 1, 0) != NGX_OK) { |
531 return; | 533 return; |
868 if (ngx_handle_read_event(ev, 0) != NGX_OK) { | 870 if (ngx_handle_read_event(ev, 0) != NGX_OK) { |
869 ngx_stream_proxy_finalize(s, NGX_ERROR); | 871 ngx_stream_proxy_finalize(s, NGX_ERROR); |
870 return; | 872 return; |
871 } | 873 } |
872 | 874 |
873 if (u->upstream_buf.start) { | 875 if (u->connected) { |
874 pc = u->peer.connection; | 876 pc = u->peer.connection; |
875 | 877 |
876 if (!c->read->delayed && !pc->read->delayed) { | 878 if (!c->read->delayed && !pc->read->delayed) { |
877 pscf = ngx_stream_get_module_srv_conf(s, | 879 pscf = ngx_stream_get_module_srv_conf(s, |
878 ngx_stream_proxy_module); | 880 ngx_stream_proxy_module); |
899 } | 901 } |
900 | 902 |
901 return; | 903 return; |
902 } | 904 } |
903 | 905 |
904 if (from_upstream && u->upstream_buf.start == NULL) { | 906 if (from_upstream && !u->connected) { |
905 return; | 907 return; |
906 } | 908 } |
907 | 909 |
908 ngx_stream_proxy_process(s, from_upstream, ev->write); | 910 ngx_stream_proxy_process(s, from_upstream, ev->write); |
909 } | 911 } |
998 ngx_stream_proxy_srv_conf_t *pscf; | 1000 ngx_stream_proxy_srv_conf_t *pscf; |
999 | 1001 |
1000 u = s->upstream; | 1002 u = s->upstream; |
1001 | 1003 |
1002 c = s->connection; | 1004 c = s->connection; |
1003 pc = u->upstream_buf.start ? u->peer.connection : NULL; | 1005 pc = u->connected ? u->peer.connection : NULL; |
1004 | 1006 |
1005 pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module); | 1007 pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module); |
1006 | 1008 |
1007 if (from_upstream) { | 1009 if (from_upstream) { |
1008 src = pc; | 1010 src = pc; |