httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject Re: New post-log-transaction hook?
Date Tue, 18 Sep 2001 09:10:42 GMT
On Mon, Sep 17, 2001 at 03:52:21PM -0700, Jon Travis wrote:
> I've got a bit of code that needs to run after a connection to a client
> has been closed.  Right now I can (kind of) spoof this by setting the
> keepalive for the client to 0, and registering a cleanup on the 
> request_req pool.  Unfortunately the code in there is somewhat bulky, 
> so any subsequent cleanups that it registers will never get called 
> (apparently registering a cleanup within a cleanup no workie).
> I'd like to propose a new hook which gets run after connection to
> the client has been closed.  (in my case, I run some cleanup code
> which can take a while, and would like the client to be on its way).
> Any thoughts?

Yes. :-)

You've confused the issue with your subject line (everybody is bugging out
because they're relating it to logging). It should not have anything to do
with "log". We have a pre-connection hook, so call yours post-connection.
That is when you want to run the hook, so we're all set.

Now the question is whether to run it before or after the ap_lingering_close
call. If it is before, then connection.c::ap_process_connection can do it.
If it is after, then there are two options:

1) make all MPMs run the hook

2) move the ap_lingering_close inside ap_process_connection, then call it
   from with ap_process_connection. This *almost* works. All MPMs have a
   call to ap_process_connection followed by a call to ap_lingering_close.
   The only MPM that does other funny stuff in there is the winnt MPM.
   Conceivably, you could pass a flag that says "I'll manage the shutdown,
   thankyouvermuch", and winnt would do its close followed by the
   post-connection hook.

Note that I *would* think that it should run afterwards, to ensure the
client has got all the data and has fully detached.

And all your spoofy nonsense can stay in your module, but it can't go in the
core. That would just be too hard to understand and maintain over the long


Greg Stein,

View raw message