apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: cvs commit: apr-util/buckets apr_buckets_socket.c
Date Tue, 09 Oct 2001 14:35:15 GMT
On 9 Oct 2001 jerenkrantz@apache.org wrote:

>   --- apr_buckets_socket.c	2001/09/29 07:06:19	1.31
>   +++ apr_buckets_socket.c	2001/10/09 05:17:18	1.32
>   @@ -76,6 +76,12 @@
>
>        if (block == APR_NONBLOCK_READ) {
>            apr_setsocketopt(p, APR_SO_TIMEOUT, timeout);
>   +        /* There was nothing to read right now, so treat it as okay and
>   +         * return a 0-length brigade (see below). */
>   +        if (APR_STATUS_IS_EAGAIN(rv)) {
>   +            *len = 0;
>   +            rv = APR_SUCCESS;
>   +        }
>        }
>

-1.  By doing this, any time you do a nonblocking read from a socket
bucket and get EAGAIN, the whole bucket vaporizes and you never get the
chance to read any more data.  It was correct before: if you ask for a
nonblocking read, you have to be ready to handle an EAGAIN case.  So we
must return EAGAIN and leave the brigade as it was... the caller can just
sit there repeatedly reading from that one bucket if they like, or they
can do some other work and come back to that bucket.  As long as the
caller doesn't treat it as fatal (which it isn't for nonblocking) and the
caller doesn't move on to the next bucket prematurely, we're fine.

--Cliff


--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA



Mime
View raw message