apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: apr/network_io/unix sockets.c
Date Tue, 07 Aug 2001 23:56:35 GMT
rbb         01/08/07 16:56:35

  Modified:    network_io/unix sockets.c
  Log:
  Finish the fix for the non-blocking connect.  Basically, we need to
  query the socket to find the actual error if the connect failed.  This
  is done using getsockopt with the SO_ERROR option.  If error == 0, then
  the connect succeeded, else error is the connect errno value.
  Submitted by:	Jeff Trawick
  
  Revision  Changes    Path
  1.85      +8 -0      apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockets.c,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- sockets.c	2001/08/07 20:24:50	1.84
  +++ sockets.c	2001/08/07 23:56:35	1.85
  @@ -273,9 +273,17 @@
        * socket; if called again, we can see EALREADY
        */
       if (rc == -1 && (errno == EINPROGRESS || errno == EALREADY) && sock->timeout
!= 0) {
  +        int error;
  +        apr_size_t len = sizeof(error);
           rc = apr_wait_for_io_or_timeout(sock, 0);
           if (rc != APR_SUCCESS) {
               return rc;
  +        }
  +        if ((rc = getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &error, &len)) <
0) {
  +            return(rc);
  +        }
  +        if (error) {
  +            return error;
           }
       }
   
  
  
  

Mime
View raw message