Welcome! Log In Create A New Profile

Advanced

Question about ngx_chain_writer

June 06, 2019 09:08AM
Hi all,

Looking at ngx_chain_writer, there's something that looks a bit off to me, this line seems redundant -
https://github.com/nginx/nginx/blob/master/src/core/ngx_output_chain.c#L728

The first loop in the function adds the input chain (in) to the end of ctx->out.
The second loop in the function calculates the total size of ctx->out, so it will add the size of the 'in' buffers again.
I verified in gdb that size is indeed x2 the size of the chain.

This isn't causing any problem since size is only compared to zero, but seems a bit confusing...
It may have been better to leave the 'size += ngx_buf_size(in->buf);' but reverse the order of the 2 loops,
so that the input buffers will be validated only once.

Does this make sense or did I get something wrong?

Thanks

Eran

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

Question about ngx_chain_writer

erankor 650 June 06, 2019 09:08AM

Re: Question about ngx_chain_writer

Maxim Dounin 384 June 06, 2019 02:10PM



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

Online Users

Guests: 267
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