httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <>
Subject Re: blocking vs non-blocking apr_bucket_read()
Date Mon, 14 Jan 2008 14:40:25 GMT
On Sat, 12 Jan 2008 19:18:10 -0500
Christina Fu <> 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

View raw message