You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Christina Fu <fu...@gmail.com> on 2008/01/13 01:18:10 UTC
blocking vs non-blocking apr_bucket_read()
Hi,
I am writing a connection level input and output filter. I have
confusions about whether to use APR_NONBLOCK_READ or APR_BLOCK_READ when
calling apr_bucket_read() function. Could someone advise the guidelines
of using blocking vs non-blocking bucket read?
I have seen situations when I use APR_NONBLOCK_READ to read a heap
bucket, it returns status of APR_SUCCESS but length is zero. Is this
case, what shall I do with this bucket? shall I read it again with
blocking? or pass it and process the next bucket?
Thanks a lot for the help!
Christina
Re: blocking vs non-blocking apr_bucket_read()
Posted by Nick Kew <ni...@webthing.com>.
On Sat, 12 Jan 2008 19:18:10 -0500
Christina Fu <fu...@gmail.com> wrote:
> Hi,
>
> I am writing a connection level input and output filter. I have
> confusions about whether to use APR_NONBLOCK_READ or APR_BLOCK_READ
> when calling apr_bucket_read() function. Could someone advise the
> guidelines of using blocking vs non-blocking bucket read?
There's nothing specific to Apache. Blocking reads are easier to
work with, but preclude certain forms of optimisation.
> I have seen situations when I use APR_NONBLOCK_READ to read a heap
> bucket, it returns status of APR_SUCCESS but length is zero.
Sounds unlikely, unless the bucket had length zero. It should
only make a difference on streaming bucket types.
> Is this
> case, what shall I do with this bucket? shall I read it again with
> blocking? or pass it and process the next bucket?
If you've nothing better to do, then yes. A filter function can
also return to its caller if you don't want blocking.
--
Nick Kew
Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/