httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject RE: socket_read?
Date Mon, 19 Feb 2001 05:18:27 GMT
---Greg Stein said:
> IMO, the bucket should transform itself from a pipe/socket to an N-length
> (heap) bucket when it discovers EOF. But *never* return EOF. The EOF is an
> "internal" indicator of the bucket.

Thanks for stating much more eloquently what I've been flailing around trying to
explain...  =-)

> When you read a bucket with APR_BLOCK_READ, it *must* always read at least
> one byte. The only reason to not read a byte is if/when the pipe/socket
> ends, so the bucket should transform to a zero-length heap bucket.

Yup.  (Like I said, we could optimize the zero-length case and use a
lighter-weight bucket type, like an immortal bucket containing "", to avoid a
few mallocs, but that's *just* an optimization.  It works exactly the same
either way.)

> If you read with APR_NONBLOCK_READ, then you may get back zero-length
> buckets. People who use this reading style should be *VERY* careful: you
> don't want to loop with NONBLOCK because you could sit there and read
> zero-length buckets for a long time.

Precisely.  One thing I've been wondering about though... how does the pipe
bucket get reinserted as the next bucket if in APR_NONBLOCK_READ mode with 0
bytes returned?  Does it work right in that case?

> That ought to do the trick. It seems like clean semantics across the board.

You're right on.  Thanks again... I didn't do half as good a job trying to
explain all this.  =-)

--Cliff


Mime
View raw message