httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: Apache 2.0 beta STATUS
Date Mon, 22 Jan 2001 18:59:18 GMT
On Mon, Jan 22, 2001 at 01:20:57PM -0500, Greg Marr wrote:
> At 01:11 AM 01/22/2001, rbb@covalent.net wrote:
> 
> > > Please, Greg and Ryan, document -simply- where your patch stands 
> > up and
> > > the other falls down, so I can grok this quickly without wadeing 
> > chin
> > > deep in the filtering mechanics!
> >
> >Using apr_brigade_flush() function, it is possible to mix the API's
> >
> >It looks like an API that programmers are used to.  There is a 
> >buffered
> >and a non-buffered API.  The direct bucket calls are unbuffered, the
> >brigade calls are buffered.  If you want to switch from buffered to
> >unbuffered, you have to call apr_brigade_flush.
> 
> Shouldn't that be ap_rflush()?

If you intend to use r->bb for further output, then apr_brigade_flush is
fine.

If you intend to construct your own brigades, then something *like*
ap_rflush() is needed. But another new function would be necessary because
you don't want an actual ap_rflush since it shoves it out the network.
Essentially, a function such as:

void ap_sync_output(request_rec *r)
{
    if (r->bb) {
        apr_brigade_flush(r->bb);
	(void) ap_pass_brigade(r->output_filters, r->bb);
    }
}

> >apr_brigade_flush is incredibly inexpensive.  If it is called and 
> >isn't needed, it is a single if and a return.
> 
> ap_rflush() is more expensive than apr_brigade_flush().

Horribly expensive due to the network implications. An API such as above is
what you're seeking.
[ again, only if you intend to not use r->bb (and note that I'd hope we
  don't ask people to use r->bb for all output) ]

> Also, wouldn't the user have to do:
> 
> if(r->bb) {
>      apr_brigade_flush(r->bb);
> }

I'd think they would use ap_sync_output(r) calls. Just flushing a brigade is
not enough. That does an internal-synchronization on the brigade, but
doesn't deal with ordering to the output chain.

[ note that apr_brigade_flush is unneeded if the buffer-to-tail-bucket
  algorithm is used; a sync between r->bb and the output would still be
  needed with that algorithm, tho ]

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message