httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rasmus Lerdorf <>
Subject Re: ap_rflush() ?
Date Mon, 27 Jul 1998 22:57:46 GMT
> >This goes back to my trouble with detecting someone hitting the STOP
> >button.  At various critical points in a complex script I would like to be
> >able to do a flush() so I can detect whether the client has gone away
> >before heading into the next resource-intensive (generally complex SQL
> >queries) part of the application.
> >
> >-Rasmus
> Does it make sense to have a callback hook into the module jump table
> indicating to the module that the client went away?  Any module
> developer working with non-Apache resource allocation/deallocation
> issues (e.g. C++ construction/destruction, database connection pooling,
> etc.) may need to perform cleanup under this type of situation.  For
> example, in the module I am writing I am managing a pool of pre-
> connected oracle sessions.  When the user hits the STOP button there
> is no indication that client went away and therefore that I should
> mark the Oracle session as available.  Currently, the bottom line
> for anyone writing a well behaved module is that they should be using
> a flush-type algorithm to detect a client that has gone away.  

This callback is already there.  Look at the register_cleanup() function. 
You can register your cleanup function here and it will get called when
the request terminates.  All requests eventually terminate for one reason
or another and this function will always get called.  My issue is
different. I don't mind checking r->connection->aborted at opportune times
in my module, but my problem is that even calling ap_rflush(r) does not
force data sitting in Apache's buffer out on the wire which means that
Apache has no way of detecting whether the client has his their STOP
button or not until such a time when Apache decides it feels like sending
data.  I am just looking for more control here.


View raw message