> > Also, I considered first using a flag in the apr_socket_t structure, but > my > > problem is that there is already one: 'disconnected'. I would use this > > flag, but after many review of the code, I still don't know the utility of > > this flag. >
Has to do with a performance tweak on Windows. AcceptEx() accepts as arguments two sockets, the listener and an unconnected accept socket. Creating a new accept socket (with a call to socket()) is very expensive on Windows (the call has to percolate through many layers of service providers each deciding if they should handle the call). Some of the Win32 socket calls enable you to recycle the accept socket (TransmitFile for instance.). If you tell TransmitFile to disconnect the accept socket, it can be reused on the AcceptEx call and this is good for a double digit performance boost serving non-keepalive requests. Check out mpm_winnt.c and apr_sendfile() on Windows to see how this flag is used. Bill