diff options
author | Igor Sysoev <igor@sysoev.ru> | 2007-08-09 13:54:33 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2007-08-09 13:54:33 +0000 |
commit | 6876bcdad64aceecb2d4b832c6a2a5e347b17ac0 (patch) | |
tree | 613a5440c084527637ef8b5bf4b36c5134c88801 /src/http/ngx_http_upstream.c | |
parent | 031a6e2906592b4f5bfa6f21eb2fe2d49478139c (diff) | |
download | nginx-6876bcdad64aceecb2d4b832c6a2a5e347b17ac0.tar.gz nginx-6876bcdad64aceecb2d4b832c6a2a5e347b17ac0.zip |
backup upstream servers
Diffstat (limited to 'src/http/ngx_http_upstream.c')
-rw-r--r-- | src/http/ngx_http_upstream.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index bc4567458..43f3ada35 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -565,9 +565,11 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) if (rc == NGX_BUSY) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no live upstreams"); + ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_NOLIVE); + return; } - if (rc == NGX_BUSY || rc == NGX_DECLINED) { + if (rc == NGX_DECLINED) { ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); return; } @@ -2153,7 +2155,9 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u, state = NGX_PEER_FAILED; } - u->peer.free(&u->peer, u->peer.data, state); + if (ft_type != NGX_HTTP_UPSTREAM_FT_NOLIVE) { + u->peer.free(&u->peer, u->peer.data, state); + } if (ft_type == NGX_HTTP_UPSTREAM_FT_TIMEOUT) { ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_ETIMEDOUT, @@ -3118,6 +3122,17 @@ ngx_http_upstream_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) continue; } + if (ngx_strncmp(value[i].data, "backup", 6) == 0) { + + if (!(uscf->flags & NGX_HTTP_UPSTREAM_BACKUP)) { + goto invalid; + } + + us->backup = 1; + + continue; + } + if (ngx_strncmp(value[i].data, "down", 4) == 0) { if (!(uscf->flags & NGX_HTTP_UPSTREAM_DOWN)) { |