Welcome! Log In Create A New Profile

Advanced

Re: ngx_http_v3_init_session function

J Carter
February 06, 2024 12:10AM
On Tue, 6 Feb 2024 00:44:56 +0000
J Carter <jordanc.carter@outlook.com> wrote:

> On Tue, 6 Feb 2024 00:16:31 +0000
> J Carter <jordanc.carter@outlook.com> wrote:
>
> > Hello,
> >
> > On Mon, 5 Feb 2024 23:24:39 +0200
> > Clima Gabriel <clima.gabrielphoto@gmail.com> wrote:
> >
> > > Hello everyone,
> > >
> > > (the code is probably clearer and attached below)
> > > This function modifies what ngx_connection_t->data points to.
> > > ngx_connection_t->data is initially *ngx_http_connection_t.
> > > The *ngx_http_connection_t is assigned to
> > > ngx_http_v3_session_t->http_connection
> > > And the *ngx_http_v3_session_t assigned to ngx_connection_t->data.
> > >
> > > Result: before ngx_connection_t->data is *ngx_http_connection_t
> > > after ngx_connection_t->data is *ngx_http_v3_session_t
> >
> > In C, a pointer to struct can be cast to a pointer to the first member
> > of that struct, as there is no padding before the first member per the
> > standard.
> >
> > The first member of ngx_http_v3_session_t is *ngx_http_connection_t.
>
> *Sorry typo here - first member is ngx_http_connection_t of course.
> >
> > Here is the commit where this was implemented.
> >
> > https://mailman.nginx.org/pipermail/nginx-devel/2023-September/BWH23FTMRUWCUZSNKXJJXEEN76ZYOK62.html
> >
> > [...]

Oh, I've just realized that is the wrong patch. There were a couple of
reworks to that patch later that I missed.. Here is the actual
changeset version, with *ngx_http_connection_t as you say:

https://hg.nginx.org/nginx/rev/4939fd04737f

It appears that this macro should be used to get ngx_http_connection_t:

https://hg.nginx.org/nginx/file/tip/src/http/v3/ngx_http_v3.h#l85

However it's likely a good idea to wait to see if the author/s will
comment on if that is safe and correct in all situations.
_______________________________________________
nginx mailing list
nginx@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

ngx_http_v3_init_session function

Clima Gabriel February 05, 2024 04:26PM

Re: ngx_http_v3_init_session function

J Carter February 05, 2024 07:18PM

Re: ngx_http_v3_init_session function

J Carter February 05, 2024 07:46PM

Re: ngx_http_v3_init_session function

J Carter February 06, 2024 12:10AM

Re: ngx_http_v3_init_session function

Roman Arutyunyan February 07, 2024 04:30AM

Re: ngx_http_v3_init_session function

Clima Gabriel February 07, 2024 08:36AM

Re: ngx_http_v3_init_session function

Roman Arutyunyan February 09, 2024 07:00AM

Re: ngx_http_v3_init_session function

Clima Gabriel February 14, 2024 11:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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