On 8/2/06, Mladen Turk <[EMAIL PROTECTED]> wrote:
Hi,
We have a problem with mod_proxy and
the way how we detect if the connection is
still opened.
Right now, the algorithm for that is as follows:
1. Remember socket timeout
2. Set timeout to 0
3. Try to read one byte
4. Restore timeout
6. If read is APR_STATUS_IS_EOF return False
5. Else return True
Now, this works most of the time on unixes,
but it fails for windows if connection goes
to the localhost.
We have that resolved for mod_jk by using
select on windows and nonblocking read on
other platforms.
See:
jk_connect.c inside jk/native/common
May be I'm pointing out something that you already know but...:
-select/poll on the socket.
-if the socket is readable AND after
(windows) result = ioctlsocket (handle, FIONREAD, &nbytes);
(unix) result = ioctl (sock_fd, FIONREAD, &nbytes);
nbytes is 0, that means that the connection has been closed on the other end.
-Gonzalo