| 1 | # HG changeset patch
|
|---|
| 2 | # User Roman Arutyunyan <arut@nginx.com>
|
|---|
| 3 | # Date 1500474493 -10800
|
|---|
| 4 | # Wed Jul 19 17:28:13 2017 +0300
|
|---|
| 5 | # Node ID 92bdf92d8ecacc07f9281530e11995c87f6a28a8
|
|---|
| 6 | # Parent a27e0c7e198ce989a181fba3c22d0c17e18f84a0
|
|---|
| 7 | Stream: fixed TCP next upstream (ticket #1317).
|
|---|
| 8 |
|
|---|
| 9 | Previously, when some data was read from the client before a backend connection
|
|---|
| 10 | failure, the next upstream could not be chosen. This was due to a check for
|
|---|
| 11 | unsent data which only makes sense for UDP. Now the connection type is checked
|
|---|
| 12 | as well.
|
|---|
| 13 |
|
|---|
| 14 | diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c
|
|---|
| 15 | --- a/src/stream/ngx_stream_proxy_module.c
|
|---|
| 16 | +++ b/src/stream/ngx_stream_proxy_module.c
|
|---|
| 17 | @@ -1665,7 +1665,9 @@ ngx_stream_proxy_next_upstream(ngx_strea
|
|---|
| 18 | u = s->upstream;
|
|---|
| 19 | pc = u->peer.connection;
|
|---|
| 20 |
|
|---|
| 21 | - if (u->upstream_out || u->upstream_busy || (pc && pc->buffered)) {
|
|---|
| 22 | + if (s->connection->type == SOCK_DGRAM
|
|---|
| 23 | + && (u->upstream_out || u->upstream_busy || (pc && pc->buffered)))
|
|---|
| 24 | + {
|
|---|
| 25 | ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
|
|---|
| 26 | "pending buffers on next upstream");
|
|---|
| 27 | ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR);
|
|---|