I mentioned this a few months ago and she seems to have fallen through the cracks... or I'm mistaken and nobody told me... I'm using the apr_socket_timeout_set call to set a timeout on a socket and then using the same call to turn the timeout off again after I've established a connection. There seems to be a small problem with the flag management in this process.

Basically, APR, as expected, makes the socket non blocking to handle the timeouts. When I turn off the timeouts, it fails to clear the flag from the socket's file descriptor because the code never sets the APR_SO_NONBLOCK flag in the APR socket's netmask. For example, the socket is properly returned to blocking if I set the socket to non blocking myself and then turn on the timeout and then turn it back off. This works because APR_SO_NONBLOCK is being set explicitly by me. I've included a patch that will set APR_SO_NONBLOCK when APR makes a socket non blocking behind the scenes to handle timeouts, it's very simple, trust me.

        Does this make sense?

--
jacob lewallen
[EMAIL PROTECTED]
Index: sockopt.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/unix/sockopt.c,v
retrieving revision 1.67
diff -u -u -r1.67 sockopt.c
--- sockopt.c   24 Feb 2003 23:13:29 -0000      1.67
+++ sockopt.c   11 Mar 2003 23:20:53 -0000
@@ -126,6 +126,7 @@
             if ((stat = sononblock(sock->socketdes)) != APR_SUCCESS) {
                 return stat;
             }
+            apr_set_option(&sock->netmask, APR_SO_NONBLOCK, 1);
         }
     } 
     else if (t < 0 && sock->timeout >= 0) {
@@ -133,6 +134,7 @@
             if ((stat = soblock(sock->socketdes)) != APR_SUCCESS) { 
                 return stat; 
             }
+            apr_set_option(&sock->netmask, APR_SO_NONBLOCK, 0);
         } 
     }
     /* must disable the incomplete read support if we change to a

Reply via email to