On Fri, Oct 05, 2001 at 03:10:55PM -0400, Cliff Woolley wrote:
> On 5 Oct 2001 [EMAIL PROTECTED] wrote:
> 
> >   ap_brigade_partition does a blocking read.
> 
> Correct.
> 
> >   Ryan, Greg, and others can figure out if ap_brigade_partition should
> >   be tweaked to handle AP_NONBLOCK_READ natively.  I'm of a mixed mind,
> >   but this addresses the short term need.
> 
> No, it shouldn't.  -1.
> 
> If you ask to partition the brigade at a certain byte offset and
> apr_brigade_partition() encounters a bucket on which it must block, it
> should do so.  Callers of apr_brigade_partition() don't want to have to
> handle nonblocking returns... all they want is the brigade split at that
> offset.  If it's nonblocking, it returns and is basically saying "Well, I
> _might_ be able to partition at that offset, but I'm not sure right now.
> Ask me again later."  All the caller's going to be able to do (because it
> really DID want a partition at that offset) is call back into
> apr_brigade_partition in a tight loop until the thing does what it wanted.
> Much much better to just have apr_brigade_partition block so that the
> result is sensible.  Fewer CPU cycles wasted, fewer cases that the caller
> has to handle.  If you want nonblocking, do it yourself.

Yup, that's what I was thinking.  =)

Now, what about the case that we want to do a blocking read but we
don't really know how much to read?  I think it is analogous to the
non-blocking case (what this commit does), but it just calls 
bucket_read with a timeout value.  Whatever it returns should be 
good enough.  We can't rely on apr_brigade_partition since it must
block.

So, I'm thinking a new ap_get_brigade mode called 
AP_BLOCKING_PARTIAL_MODE might do the trick.  It tells the core input 
filter that it is okay to return less than that number of bytes.  It 
issues *one* blocking read and returns at most *readbytes (or len 
returning from bucket_read if smaller) back in the brigade.  I think 
this would make mod_ssl much happier.  =)

Has anyone thought of this before?  Was it shot down?  Is it a
good idea?

> (Besides, Ryan already tried this once and realized that it was bad and
> reverted his change.)

Yeah, I feel like I'm treading water here.  =)  -- justin

Reply via email to