apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject cvs commit: apr/network_io/beos sendrecv.c
Date Wed, 04 Apr 2001 21:43:05 GMT
dreid       01/04/04 14:43:05

  Modified:    network_io/beos sendrecv.c
  Log:
  Try to resolve the send blocking issues on BeOS R5.
  
  Revision  Changes    Path
  1.21      +21 -3     apr/network_io/beos/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/beos/sendrecv.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- sendrecv.c	2001/03/20 13:47:00	1.20
  +++ sendrecv.c	2001/04/04 21:43:04	1.21
  @@ -92,6 +92,9 @@
       return APR_SUCCESS;
   }
   
  +#define SEND_WAIT APR_USEC_PER_SEC / 10
  +#define MAX_SEND_WAIT 2 * APR_USEC_PER_SEC
  +
   apr_status_t apr_send(apr_socket_t *sock, const char *buf, apr_size_t *len)
   {
       ssize_t rv;
  @@ -101,16 +104,31 @@
       } while (rv == -1 && errno == EINTR);
   
       if (rv == -1 && errno == EWOULDBLOCK && sock->timeout > 0) {
  +        apr_int32_t snooze = SEND_WAIT;
  +        apr_int32_t zzz = 0;  
  +        int loop = 1;
  +/*        
           apr_status_t arv = wait_for_io_or_timeout(sock, 0);
           if (arv != APR_SUCCESS) {
               *len = 0;
               return arv;
           }
           else {
  -            do {
  -                rv = send(sock->socketdes, buf, (*len), 0);
  -            } while (rv == -1 && errno == EINTR);
  +*/
  +        do {
  +            rv = send(sock->socketdes, buf, (*len), 0);
  +            if (rv == -1 && errno == EWOULDBLOCK){
  +                snooze (snooze_val);
  +                zzz += snooze_val;
  +                snooze_val += (SEND_WAIT * loop++);
  +                /* have we passed our timeout value */
  +                if (zzz > (sock->timeout * APR_USECS_PER_SEC))
  +                    break;
  +            }
  +        } while (rv == -1 && (errno == EINTR || errno == EWOULDBLOCK));
  +/*
           }
  +*/
       }
       if (rv == -1) {
           *len = 0;
  
  
  

Mime
View raw message