Welcome! Log In Create A New Profile

Advanced

[nginx] Output chain: free chain links in ngx_chain_writer().

Maxim Dounin
March 23, 2015 02:12PM
details: http://hg.nginx.org/nginx/rev/66176dfea01e
branches:
changeset: 6046:66176dfea01e
user: Maxim Dounin <mdounin@mdounin.ru>
date: Mon Mar 23 21:09:05 2015 +0300
description:
Output chain: free chain links in ngx_chain_writer().

diffstat:

src/core/ngx_output_chain.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)

diffs (39 lines):

diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -654,7 +654,7 @@ ngx_chain_writer(void *data, ngx_chain_t
ngx_chain_writer_ctx_t *ctx = data;

off_t size;
- ngx_chain_t *cl;
+ ngx_chain_t *cl, *ln, *chain;
ngx_connection_t *c;

c = ctx->connection;
@@ -734,15 +734,23 @@ ngx_chain_writer(void *data, ngx_chain_t
return NGX_OK;
}

- ctx->out = c->send_chain(c, ctx->out, ctx->limit);
+ chain = c->send_chain(c, ctx->out, ctx->limit);

ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0,
- "chain writer out: %p", ctx->out);
+ "chain writer out: %p", chain);

- if (ctx->out == NGX_CHAIN_ERROR) {
+ if (chain == NGX_CHAIN_ERROR) {
return NGX_ERROR;
}

+ for (cl = ctx->out; cl && cl != chain; /* void */) {
+ ln = cl;
+ cl = cl->next;
+ ngx_free_chain(ctx->pool, ln);
+ }
+
+ ctx->out = chain;
+
if (ctx->out == NULL) {
ctx->last = &ctx->out;


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Output chain: free chain links in ngx_chain_writer().

Maxim Dounin 681 March 23, 2015 02:12PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 302
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready