Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 4116:9baf12ea5ca1
Upstream: separate pool for peer connections.
This is required to support persistent https connections as various ssl
structures are allocated from connection's pool.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 15 Sep 2011 18:21:24 +0000 |
parents | 70a45a504905 |
children | 103b0d9afe07 |
comparison
equal
deleted
inserted
replaced
4115:70a45a504905 | 4116:9baf12ea5ca1 |
---|---|
1134 u->read_event_handler = ngx_http_upstream_process_header; | 1134 u->read_event_handler = ngx_http_upstream_process_header; |
1135 | 1135 |
1136 c->sendfile &= r->connection->sendfile; | 1136 c->sendfile &= r->connection->sendfile; |
1137 u->output.sendfile = c->sendfile; | 1137 u->output.sendfile = c->sendfile; |
1138 | 1138 |
1139 c->pool = r->pool; | 1139 if (c->pool == NULL) { |
1140 | |
1141 /* we need separate pool here to be able to cache SSL connections */ | |
1142 | |
1143 c->pool = ngx_create_pool(128, r->connection->log); | |
1144 if (c->pool == NULL) { | |
1145 ngx_http_upstream_finalize_request(r, u, | |
1146 NGX_HTTP_INTERNAL_SERVER_ERROR); | |
1147 return; | |
1148 } | |
1149 } | |
1150 | |
1140 c->log = r->connection->log; | 1151 c->log = r->connection->log; |
1152 c->pool->log = c->log; | |
1141 c->read->log = c->log; | 1153 c->read->log = c->log; |
1142 c->write->log = c->log; | 1154 c->write->log = c->log; |
1143 | 1155 |
1144 /* init or reinit the ngx_output_chain() and ngx_chain_writer() contexts */ | 1156 /* init or reinit the ngx_output_chain() and ngx_chain_writer() contexts */ |
1145 | 1157 |
2888 | 2900 |
2889 (void) ngx_ssl_shutdown(u->peer.connection); | 2901 (void) ngx_ssl_shutdown(u->peer.connection); |
2890 } | 2902 } |
2891 #endif | 2903 #endif |
2892 | 2904 |
2905 ngx_destroy_pool(u->peer.connection->pool); | |
2893 ngx_close_connection(u->peer.connection); | 2906 ngx_close_connection(u->peer.connection); |
2894 } | 2907 } |
2895 | 2908 |
2896 #if 0 | 2909 #if 0 |
2897 if (u->conf->busy_lock && !u->busy_locked) { | 2910 if (u->conf->busy_lock && !u->busy_locked) { |
2982 | 2995 |
2983 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 2996 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2984 "close http upstream connection: %d", | 2997 "close http upstream connection: %d", |
2985 u->peer.connection->fd); | 2998 u->peer.connection->fd); |
2986 | 2999 |
3000 ngx_destroy_pool(u->peer.connection->pool); | |
2987 ngx_close_connection(u->peer.connection); | 3001 ngx_close_connection(u->peer.connection); |
2988 } | 3002 } |
2989 | 3003 |
2990 u->peer.connection = NULL; | 3004 u->peer.connection = NULL; |
2991 | 3005 |