aboutsummaryrefslogtreecommitdiff
path: root/src/stream/ngx_stream_proxy_module.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2016-12-26 14:27:05 +0300
committerRoman Arutyunyan <arut@nginx.com>2016-12-26 14:27:05 +0300
commit6dae95a7d499c836f72a585961cb80166ed5fde7 (patch)
treec39911bf624cfe2c8e479dc14a340cf95ed7d8a2 /src/stream/ngx_stream_proxy_module.c
parent77471dbdbb73f637eaa1205b7e1dbdb770ad27f2 (diff)
downloadnginx-6dae95a7d499c836f72a585961cb80166ed5fde7.tar.gz
nginx-6dae95a7d499c836f72a585961cb80166ed5fde7.zip
Stream: speed up TCP peer recovery.
Previously, an unavailable peer was considered recovered after a successful proxy session to this peer. Until then, only a single client connection per fail_timeout was allowed to be proxied to the peer. Since stream sessions can be long, it may take indefinite time for a peer to recover, limiting the ability of the peer to receive new connections. Now, a peer is considered recovered after a successful TCP connection is established to it. Balancers are notified of this event via the notify() callback.
Diffstat (limited to 'src/stream/ngx_stream_proxy_module.c')
-rw-r--r--src/stream/ngx_stream_proxy_module.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c
index c03b51505..bfd78d5bb 100644
--- a/src/stream/ngx_stream_proxy_module.c
+++ b/src/stream/ngx_stream_proxy_module.c
@@ -808,6 +808,11 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)
u->state->connect_time = ngx_current_msec - u->state->response_time;
+ if (u->peer.notify) {
+ u->peer.notify(&u->peer, u->peer.data,
+ NGX_STREAM_UPSTREAM_NOTIFY_CONNECT);
+ }
+
c->log->action = "proxying connection";
if (u->upstream_buf.start == NULL) {