httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/network_io/unix sendrecv.c
Date Fri, 07 Jul 2000 03:00:45 GMT
trawick     00/07/06 20:00:44

  Modified:    src/lib/apr/network_io/unix sendrecv.c
  Log:
  ap_sendfile() fixes:
  
  Linux flavor: get it working with non-blocking sockets which
    don't have a timeout
  
  Revision  Changes    Path
  1.32      +25 -1     apache-2.0/src/lib/apr/network_io/unix/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sendrecv.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- sendrecv.c	2000/07/07 02:54:54	1.31
  +++ sendrecv.c	2000/07/07 03:00:44	1.32
  @@ -218,7 +218,7 @@
   {
       off_t off = *offset;
       int corkflag = 1;
  -    int rv, nbytes = 0;
  +    int rv, nbytes = 0, total_hdrbytes, i;
       ap_status_t arv;
   
       /* Ignore flags for now. */
  @@ -241,6 +241,21 @@
               return errno;
           }
           nbytes += hdrbytes;
  +
  +        /* If this was a partial write and we aren't doing timeouts, 
  +         * return now with the partial byte count; this is a non-blocking 
  +         * socket.
  +         */
  +        if (sock->timeout <= 0) {
  +            total_hdrbytes = 0;
  +            for (i = 0; i < hdtr->numheaders; i++) {
  +                total_hdrbytes += hdtr->headers[i].iov_len;
  +            }
  +            if (hdrbytes < total_hdrbytes) {
  +                *len = hdrbytes;
  +                return APR_SUCCESS;
  +            }
  +        }
       }
   
       do {
  @@ -275,6 +290,15 @@
       }
   
       nbytes += rv;
  +
  +    /* If this was a partial write, return now with the partial byte count; 
  +     * this is a non-blocking socket.
  +     */
  +
  +    if (rv < *len) {
  +        *len = nbytes;
  +        return APR_SUCCESS;
  +    }
   
       /* Now write the footers */
       if (hdtr->numtrailers > 0) {
  
  
  

Mime
View raw message