httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <stodd...@raleigh.ibm.com>
Subject APR_EOF?
Date Thu, 22 Jun 2000 17:46:57 GMT
Take a look at this snip of code from read_with_errors...

  if (rv != APR_SUCCESS) {
        do {
            rv = iol_read(fb->iol, buf, nbyte, bytes_read);
        } while (rv == EINTR && !(fb->flags &B_EOUT));
    }
    if (rv == APR_SUCCESS && *bytes_read == 0) {
         fb->flags |= B_EOF;
    }

Notice we are setting B_EOF if APR_SUCCESS and no bytes read.  I prefer this behavious to
checking for APR_EOF.  Do we have agreement on how APR signals EOF conditions?  Notice
also that iol_read can be reading from a socket which implies ap_recv() must do the right
thing as well.

On a related topic, is there any reason why we can't consolidate the ap_read code across
platforms? ap_read must:

1. handle the ungetchar
2. handle reads (non-blocking, non-blocking with timeouts and blocking)
3. buffered i/o
4. 1 thru 3 for both files and pipes

Most of this code is identical across Unix and Windows which implies we should create a
common ap_read() implementation which calls a platform specific os_read_with_timeout().
os_read_with_timeout() is where the platform specific code resides.
os_read_with_timeout() would need to know if it is handling a pipe or a file.  Right now,
each platform is handling the ungetchar, buffered reads, etc. differently, which is not
good.

Why not combine socket i/o with file i/o,  i.e., make ap_read() handle sockets, pipes and
files and eliminate entirely ap_recv()? Ditto the ap_write() and ap_send.

Bill



Mime
View raw message