Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions ngx_http_multi_upstream_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ ngx_http_multi_upstream_connection_detach(ngx_connection_t *c)
ngx_int_t
ngx_http_multi_upstream_connection_close(ngx_connection_t *c)
{
ngx_pool_t *pool;

#if (NGX_HTTP_SSL)
/* TODO: do not shutdown persistent connection */
if (c->ssl) {
Expand All @@ -746,14 +748,20 @@ ngx_http_multi_upstream_connection_close(ngx_connection_t *c)
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
"multi: close http upstream connection: %d", c->fd);

if (c->pool) {
ngx_destroy_pool(c->pool);
}

c->destroyed = 1;

/* ngx_close_connection() still logs through c->log, which lives in c->pool,
* so the pool has to outlive it - the same order ngx_http_close_connection()
* uses */
pool = c->pool;
c->pool = NULL;

ngx_close_connection(c);

if (pool) {
ngx_destroy_pool(pool);
}

return NGX_OK;
}

Expand Down