apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: apr_socket_accept() interrupted on Win32 corrupts master socket?
Date Mon, 03 Feb 2003 22:52:06 GMT
At 09:22 AM 2/3/2003, Vaclav Ovsik wrote:
>I have written some very simple test server using apr (src included).
>I met a problem on Windoze NT (among other things):
>When the receive timeout occures on a call apr_socket_recv() in the
>serving thread, a call to apr_socket_accept() is also interrupted in the
>main thread. Next accept on the same socket ends on "socket operation on

The answer is really sort of simple, but I'm still working on the resolution...

There is no such thing as a blocking Win32 socket.  Since Unix respects
a socket timeout, irrespective of blocking/nonblocking, we use those modes
appropriately.  On Win32, there are no socket timeouts, and therefore no
way to do timeouts on blocking sockets.  Therefore the entire blocking and
nonblocking magic is coded under the hood within APR.

This means every call that *can* return WSAEAGAIN/WSAEWOULDBLOCK
must perform it's own wait call with the timeout against whatever operation
we just attempted.  This is done correctly in the read/write calls, but we
neglected to perform that loop within the accept call.

Our bad, me culpa, I'm working on the fix.

Thanks again for the report and the example code!!!


View raw message