Ticket #1317: stream-udp-next-upstream

File stream-udp-next-upstream, 1.2 KB (added by Roman Arutyunyan, 9 years ago)
Line 
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
7Stream: fixed TCP next upstream (ticket #1317).
8
9Previously, when some data was read from the client before a backend connection
10failure, the next upstream could not be chosen. This was due to a check for
11unsent data which only makes sense for UDP. Now the connection type is checked
12as well.
13
14diff --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);