Welcome! Log In Create A New Profile

Advanced

Re: Question about source code: Any need to call ngx_event_pipe_remove_shadow_links in ngx_event_pipe_read_upstream?

Maxim Dounin
May 18, 2015 03:12PM
Hello!

On Sun, May 17, 2015 at 02:36:08PM +0800, J.J J wrote:

> Hi, all:
>
> nginx code version: 1.7.9 ( I have checked v1.9.0, no change about this)
>
> The bufs used to invoke ngx_event_pipe_remove_shadow_links in
> ngx_event_pipe_read_upstream come from p->preread_bufs or p->free_raw_bufs
> or new allocated buf.
>
> Both p->preread_bufs and new allocated buf have no shadow link.
>
> p->preread_bufs is inited to be NULL, and there are two places which will
> add free buffer into it: ngx_event_pipe_write_chain_to_temp_file and
> ngx_event_pipe_write_to_downstream.
>
> In both places, shadow links are cleared by ngx_event_pipe_add_free_buf or
> by ngx_event_pipe_remove_shadow_links.
>
> So, there is no need to call ngx_event_pipe_remove_shadow_links
> in ngx_event_pipe_read_upstream at all, for shadow link will always be NULL.
>
> Am I missing something ? Or just lack of code review ?

Most likely you are right and these calls are not needed. I came
to a similar conslusion while looking into this code a while ago.
The code to work with shadow links was introduced in ancient
times, before nginx 0.1.0, and it needs some cleanup.

--
Maxim Dounin
http://nginx.org/

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

Question about source code: Any need to call ngx_event_pipe_remove_shadow_links in ngx_event_pipe_read_upstream?

J.J J May 17, 2015 02:38AM

Re: Question about source code: Any need to call ngx_event_pipe_remove_shadow_links in ngx_event_pipe_read_upstream?

Maxim Dounin May 18, 2015 03:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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