Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 1378:0be898896d1a
backup upstream servers
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 09 Aug 2007 13:54:33 +0000 |
parents | 32cdba6f2ec1 |
children | 6c25a49e548a |
comparison
equal
deleted
inserted
replaced
1377:0d57c150115b | 1378:0be898896d1a |
---|---|
563 | 563 |
564 u->state->peer = u->peer.name; | 564 u->state->peer = u->peer.name; |
565 | 565 |
566 if (rc == NGX_BUSY) { | 566 if (rc == NGX_BUSY) { |
567 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no live upstreams"); | 567 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "no live upstreams"); |
568 } | 568 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_NOLIVE); |
569 | 569 return; |
570 if (rc == NGX_BUSY || rc == NGX_DECLINED) { | 570 } |
571 | |
572 if (rc == NGX_DECLINED) { | |
571 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); | 573 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); |
572 return; | 574 return; |
573 } | 575 } |
574 | 576 |
575 /* rc == NGX_OK || rc == NGX_AGAIN */ | 577 /* rc == NGX_OK || rc == NGX_AGAIN */ |
2151 state = NGX_PEER_NEXT; | 2153 state = NGX_PEER_NEXT; |
2152 } else { | 2154 } else { |
2153 state = NGX_PEER_FAILED; | 2155 state = NGX_PEER_FAILED; |
2154 } | 2156 } |
2155 | 2157 |
2156 u->peer.free(&u->peer, u->peer.data, state); | 2158 if (ft_type != NGX_HTTP_UPSTREAM_FT_NOLIVE) { |
2159 u->peer.free(&u->peer, u->peer.data, state); | |
2160 } | |
2157 | 2161 |
2158 if (ft_type == NGX_HTTP_UPSTREAM_FT_TIMEOUT) { | 2162 if (ft_type == NGX_HTTP_UPSTREAM_FT_TIMEOUT) { |
2159 ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_ETIMEDOUT, | 2163 ngx_log_error(NGX_LOG_ERR, r->connection->log, NGX_ETIMEDOUT, |
2160 "upstream timed out"); | 2164 "upstream timed out"); |
2161 } | 2165 } |
3116 } | 3120 } |
3117 | 3121 |
3118 continue; | 3122 continue; |
3119 } | 3123 } |
3120 | 3124 |
3125 if (ngx_strncmp(value[i].data, "backup", 6) == 0) { | |
3126 | |
3127 if (!(uscf->flags & NGX_HTTP_UPSTREAM_BACKUP)) { | |
3128 goto invalid; | |
3129 } | |
3130 | |
3131 us->backup = 1; | |
3132 | |
3133 continue; | |
3134 } | |
3135 | |
3121 if (ngx_strncmp(value[i].data, "down", 4) == 0) { | 3136 if (ngx_strncmp(value[i].data, "down", 4) == 0) { |
3122 | 3137 |
3123 if (!(uscf->flags & NGX_HTTP_UPSTREAM_DOWN)) { | 3138 if (!(uscf->flags & NGX_HTTP_UPSTREAM_DOWN)) { |
3124 goto invalid; | 3139 goto invalid; |
3125 } | 3140 } |