You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Eric Covener <co...@gmail.com> on 2009/02/23 18:35:02 UTC

Re: Callback function which is just called before connection is destroyed

On Mon, Feb 23, 2009 at 11:46 AM, Ashish Khare <as...@gmail.com> wrote:
> Hi,
>
> I need one small help from you.
> I have one memory allocation(malloc) of application associated with "r"
> parameter  in input filter and output filter.
> I need to de-alloacte this memory and I want to de-allocate when session
> ends.
> Can any one of you please help me, which callback is used to notify the
> session ends in Apache.
> Fast reponse is appreciated.

You can register a cleanup on r->connection->pool and it will run when
the connection is cleaned up, but it's not clear if that's what you
mean by a "session".
-- 
Eric Covener
covener@gmail.com

Re: Callback function which is just called before connection is destroyed

Posted by Ashish Khare <as...@gmail.com>.
Eric,

Got in doubt.. Sorry to bog you down with so much questions.
I think the same will serve for cleanup at the end of response.
Am i right ?

-Ashish

On Mon, Feb 23, 2009 at 11:47 PM, Eric Covener <co...@gmail.com> wrote:

> On Mon, Feb 23, 2009 at 1:13 PM, Ashish Khare <as...@gmail.com> wrote:
> > Eric,
> >
> > Thanks for the clarification.
> > Just one more question.
> > My requirement is when request or associated reponse is served. I need to
> > clean up my memory functions.
> > I think your suggestion "r->connection->pool' will solve my problem.
> > Please confirm.
>
> A cleanup at the end of a request should be registered against r->pool.
>
> --
>  Eric Covener
> covener@gmail.com
>

Re: Callback function which is just called before connection is destroyed

Posted by Eric Covener <co...@gmail.com>.
On Mon, Feb 23, 2009 at 1:13 PM, Ashish Khare <as...@gmail.com> wrote:
> Eric,
>
> Thanks for the clarification.
> Just one more question.
> My requirement is when request or associated reponse is served. I need to
> clean up my memory functions.
> I think your suggestion "r->connection->pool' will solve my problem.
> Please confirm.

A cleanup at the end of a request should be registered against r->pool.

-- 
Eric Covener
covener@gmail.com

Re: Callback function which is just called before connection is destroyed

Posted by Ashish Khare <as...@gmail.com>.
Eric,

Thanks for the clarification.
Just one more question.
My requirement is when request or associated reponse is served. I need to
clean up my memory functions.
I think your suggestion "r->connection->pool' will solve my problem.
Please confirm.

-Ashish



On Mon, Feb 23, 2009 at 11:37 PM, Eric Covener <co...@gmail.com> wrote:

> On Mon, Feb 23, 2009 at 12:53 PM, Ashish Khare <as...@gmail.com> wrote:
> > Hi Eric,
> >
> > Thanks for the fast response.
> > By "Session" I mean when the request comes into the picture, the "c"
> > <Connection> and "r"<request_rec> parameters are intialized.
> > Session ends when the request is served. the "c" and "r" parameters got
> > destroyed or cleanup.
> >
> > Can you please send me the code snippet to register the cleanup function
> as
> > you suggested.
>
> They're not initialized and destroyed together, e.g. keepalive.
>
> See ssl_io_filter_init in modules/ssl/ssl_engine_io.c, except you'd
> need to grab the conn_rec from the request_rec.
>
> --
>  Eric Covener
> covener@gmail.com
>

Re: Callback function which is just called before connection is destroyed

Posted by Eric Covener <co...@gmail.com>.
On Mon, Feb 23, 2009 at 12:53 PM, Ashish Khare <as...@gmail.com> wrote:
> Hi Eric,
>
> Thanks for the fast response.
> By "Session" I mean when the request comes into the picture, the "c"
> <Connection> and "r"<request_rec> parameters are intialized.
> Session ends when the request is served. the "c" and "r" parameters got
> destroyed or cleanup.
>
> Can you please send me the code snippet to register the cleanup function as
> you suggested.

They're not initialized and destroyed together, e.g. keepalive.

See ssl_io_filter_init in modules/ssl/ssl_engine_io.c, except you'd
need to grab the conn_rec from the request_rec.

-- 
Eric Covener
covener@gmail.com

Re: Callback function which is just called before connection is destroyed

Posted by Ashish Khare <as...@gmail.com>.
Hi Eric,

Thanks for the fast response.
By "Session" I mean when the request comes into the picture, the "c"
<Connection> and "r"<request_rec> parameters are intialized.
Session ends when the request is served. the "c" and "r" parameters got
destroyed or cleanup.

Can you please send me the code snippet to register the cleanup function as
you suggested.
-Ashish
On Mon, Feb 23, 2009 at 11:05 PM, Eric Covener <co...@gmail.com> wrote:

>  On Mon, Feb 23, 2009 at 11:46 AM, Ashish Khare <as...@gmail.com>
> wrote:
> > Hi,
> >
> > I need one small help from you.
> > I have one memory allocation(malloc) of application associated with "r"
> > parameter  in input filter and output filter.
> > I need to de-alloacte this memory and I want to de-allocate when session
> > ends.
> > Can any one of you please help me, which callback is used to notify the
> > session ends in Apache.
> > Fast reponse is appreciated.
>
> You can register a cleanup on r->connection->pool and it will run when
> the connection is cleaned up, but it's not clear if that's what you
> mean by a "session".
> --
> Eric Covener
> covener@gmail.com
>