httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <>
Subject RE: socket_read?
Date Mon, 19 Feb 2001 17:35:36 GMT
> -----Original Message-----
> Right.  But if converted-self has zero bytes, then requeued-after-self
> is never even created.  Here's a re-annotated copy of the relevant parts of
> socket_read():

Oh, wait-- I think I figured it out.  In nonblocking mode, the return value from
apr_recv() is neither APR_SUCCESS nor APR_EOF... it's EWOULDBLOCK or EAGAIN or
something.  So that's the flag to the caller that it shouldn't move on to the
next bucket, but rather just keep trying the current bucket (which remains a
socket bucket, unchanged).  That's nice, because it keeps us from injecting a
possibly unbounded number of empty buckets into the brigade.  The end of
socket_read() then becomes this:

    if (*len > 0) {
        apr_bucket_heap_make(a, buf, *len, 0, NULL);
        APR_BUCKET_INSERT_AFTER(a, apr_bucket_socket_create(p));
    else {
        apr_bucket_immortal_make(a, "", 0);
    return APR_SUCCESS;

Am I getting there?


View raw message