Mercurial > hg > nginx
comparison src/http/modules/proxy/ngx_http_proxy_upstream.c @ 178:a8ff48d26cca
nginx-0.0.1-2003-11-11-00:09:22 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 10 Nov 2003 21:09:22 +0000 |
parents | 4db54fdbcbe7 |
children | 5a9bbe99008b |
comparison
equal
deleted
inserted
replaced
177:4db54fdbcbe7 | 178:a8ff48d26cca |
---|---|
335 if (rc == NGX_OK) { | 335 if (rc == NGX_OK) { |
336 ngx_http_proxy_connect(p); | 336 ngx_http_proxy_connect(p); |
337 return; | 337 return; |
338 } | 338 } |
339 | 339 |
340 ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); | |
341 | |
340 if (rc == NGX_DONE) { | 342 if (rc == NGX_DONE) { |
341 ft_type = NGX_HTTP_PROXY_FT_BUSY_LOCK; | 343 ft_type = NGX_HTTP_PROXY_FT_BUSY_LOCK; |
342 | 344 |
343 } else { | 345 } else { |
344 /* rc == NGX_ERROR */ | 346 /* rc == NGX_ERROR */ |
1051 } | 1053 } |
1052 | 1054 |
1053 if (p->upstream->peer.connection) { | 1055 if (p->upstream->peer.connection) { |
1054 if (ep->upstream_done && p->cachable) { | 1056 if (ep->upstream_done && p->cachable) { |
1055 if (ngx_http_proxy_update_cache(p) == NGX_ERROR) { | 1057 if (ngx_http_proxy_update_cache(p) == NGX_ERROR) { |
1056 ngx_http_busy_unlock_cachable(p->lcf->busy_lock, &p->busy_lock); | 1058 ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); |
1057 ngx_http_proxy_finalize_request(p, 0); | 1059 ngx_http_proxy_finalize_request(p, 0); |
1058 return; | 1060 return; |
1059 } | 1061 } |
1060 | 1062 |
1061 ngx_http_busy_unlock_cachable(p->lcf->busy_lock, &p->busy_lock); | |
1062 | |
1063 } else if (ep->upstream_eof && p->cachable) { | 1063 } else if (ep->upstream_eof && p->cachable) { |
1064 | 1064 |
1065 /* TODO: check length & update cache */ | 1065 /* TODO: check length & update cache */ |
1066 | 1066 |
1067 if (ngx_http_proxy_update_cache(p) == NGX_ERROR) { | 1067 if (ngx_http_proxy_update_cache(p) == NGX_ERROR) { |
1068 ngx_http_busy_unlock_cachable(p->lcf->busy_lock, &p->busy_lock); | 1068 ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); |
1069 ngx_http_proxy_finalize_request(p, 0); | 1069 ngx_http_proxy_finalize_request(p, 0); |
1070 return; | 1070 return; |
1071 } | 1071 } |
1072 | |
1073 ngx_http_busy_unlock_cachable(p->lcf->busy_lock, &p->busy_lock); | |
1074 } | 1072 } |
1075 | 1073 |
1076 if (ep->upstream_done || ep->upstream_eof || ep->upstream_error) { | 1074 if (ep->upstream_done || ep->upstream_eof || ep->upstream_error) { |
1075 ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); | |
1077 ngx_http_proxy_close_connection(p); | 1076 ngx_http_proxy_close_connection(p); |
1078 } | 1077 } |
1079 } | 1078 } |
1080 | 1079 |
1081 if (ep->downstream_done) { | 1080 if (ep->downstream_done) { |
1101 static void ngx_http_proxy_next_upstream(ngx_http_proxy_ctx_t *p, int ft_type) | 1100 static void ngx_http_proxy_next_upstream(ngx_http_proxy_ctx_t *p, int ft_type) |
1102 { | 1101 { |
1103 int status; | 1102 int status; |
1104 | 1103 |
1105 ngx_log_debug(p->request->connection->log, "next upstream: %d" _ ft_type); | 1104 ngx_log_debug(p->request->connection->log, "next upstream: %d" _ ft_type); |
1105 | |
1106 ngx_http_busy_unlock(p->lcf->busy_lock, &p->busy_lock); | |
1106 | 1107 |
1107 if (ft_type != NGX_HTTP_PROXY_FT_HTTP_404) { | 1108 if (ft_type != NGX_HTTP_PROXY_FT_HTTP_404) { |
1108 ngx_event_connect_peer_failed(&p->upstream->peer); | 1109 ngx_event_connect_peer_failed(&p->upstream->peer); |
1109 } | 1110 } |
1110 | 1111 |