apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: cvs commit: apr/network_io/unix sendrecv.c
Date Tue, 24 Jul 2001 14:51:24 GMT
jerenkrantz@apache.org writes:

> jerenkrantz    01/07/23 20:02:58
> 
>   Modified:    .        CHANGES configure.in
>                network_io/unix sendrecv.c
>   Log:
>   Add Solaris 8 sendfilev() support.
>   
>   Index: sendrecv.c

>   +    /* If we are in non-blocking mode, we need to make sure we wait until
>   +     * the other side says it is okay. */ 
>   +    if (apr_is_option_set(sock->netmask, APR_SO_NONBLOCK) == 1 ||
>   +        apr_is_option_set(sock->netmask, APR_SO_TIMEOUT) == 1)
>   +    { 
>   +        rv = apr_wait_for_io_or_timeout(sock, 0);
>   +    }

1) bug

   We shouldn't wait for writability when the app has set the APR
   nonblock option.  We only do that when the app has set the APR
   timeout option to non-zero.

2) performance...

   You should check for writability *after* sendfilev() returns
   EAGAIN.  Otherwise, we get extra syscalls from time to time.

   Yeah, rbb made the FreeBSD apr_sendfile() check for writability
   first, but it is preferable to call sendfilev() first *then* wait
   if needed.

   Since a web server will use sendfile() often on small files (e.g.,
   .png) you can bet that this will have a bunch of unnecessary
   select() calls.

>   +
>   +    /* Actually do the sendfilev */
>   +    do {
>   +        /* socket, vecs, number of vecs, bytes written */
>   +        rv = sendfilev(sock->socketdes,	sfv, vecs, &nbytes);
>   +    } while (rv == -1 && errno == EINTR);
>   +
>   +    /* Solaris returns EAGAIN even though it sent bytes on a non-block sock */
>   +    if (rv == -1 && errno != EAGAIN) {
>   +        rv = errno;
>   +        return rv;
>   +    }

-- 
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message