apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: [PATCH] Buckets: add copy function, ap_bucket_split_any(), etc
Date Sat, 09 Dec 2000 02:13:03 GMT
On Fri, Dec 08, 2000 at 11:31:30AM -0800, Cliff Woolley wrote:
>...
> Since ap_bucket_split_any() is what we agree on, then let's move on and figure out
> what the best approach is to improving it to handle sockets and pipes better.  It
> really is too bad that the read() function ignores the len parameter.

In general, LEN is how much is available. Rather than having to deal with
partial reads, the design was "here is all that I have."

Also note that you can't split a pipe at point=1000 if it only contains 20
bytes.

> If it didn't,
> then split_any() could just tell it how much to read, and this wouldn't be as much
> of an issue.  Alternately, split_any() could just keep track of how much was read
> and loop through an arbitrary number of reads, incrementing until the totals
> matched.  That's the least intrusive approach.  I'll implement it if people agree. 
> Thoughts?

This is the approach that I had in mind. It is quite simple, actually: loop
until the read() returns a length such that point <= length. If point >
length, then subtract the length from point, and read the next bucket.

Note that *no* split should occur when point == length.

Cheers,
-g

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

Mime
View raw message