apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Lewallen <jlewa...@cs.ucr.edu>
Subject Socket timeouts and APR_SO_NONBLOCK?
Date Tue, 11 Mar 2003 23:22:39 GMT
    Hey there gang. I'm using the apr_socket_timeout_set() call to set a 
timeout on a socket. Then I establish my connection and turn off the 
timeout by calling the same function with an interval of -1. Now this 
works great and I love it since it saves me from all the other headaches 
involved with setting timeouts on calls to connect. Now, APR makes the 
socket non blocking in order to do this, which is fine and makes sense. 
Now when I turn off the timeout, 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 problem never occurs 
if I set the socket to non blocking myself via a call to 
apr_socket_set_opt and then set my timeout, because now when I turn off 
the timeouts, it sees that APR_SO_NONBLOCK is set and turns it off. It 
seems to me that apr_socket_timeout_set should set the APR_SO_NONBLOCK 
also, since it is making the socket nonblocking. . .  I've included a 
patch that does this although I'm not sure this is how the majority 
would prefer I do it, just the easiest way (ahem, 2 lines) and solves my 

Does this make sense? Is this the intended behavior?

jacob lewallen

View raw message