Adrian Chadd wrote:
> I drew some of this out on paper after I sent my last mail. To detect
> half-closed connections you read the FD and if EOF under certain
> conditions you want. You can't poll the fd since the FD will always
> return read ready. .. so yu need to do a read() and handle the
> return. What I was thinking about is to 'inject' data into a comm_read().
> That would be a neat solution. Got any other suggestions ?
You only need to detect this once. Then it is a known fact. You cannot
receive any more from that socket.
My suggesting is to simply have comm_read return EOF and then be done
with it. After that no further comm_read should be issued on that
filedescriptor, and should return EOF if attempted. comm_read should
never mark a EOF state filedescriptor for select.
For a binady data stream EOF is usually indicated by zero bytes of data
returned.
write will tell you if there are any error sending data out on the
socket, and getsockopt(..SO_ERROR) can be used to periodically poll the
socket for errors when there is no activity. Polling for an error only
useful if keep-alives are enabled or the client properly sends RESET
when aborting the connection (ABORT TCP operation, defined in Internet
Standard 6 but not covered in the "standard" sockets API).
/Henrik
attached mail follows:
The original message was received at Wed, 31 May 2000 19:57:34 +0200 (CEST)
from root@localhost
----- The following addresses had permanent fatal errors -----
squid-dev@squid-cche.org
----- Transcript of session follows -----
550 squid-dev@squid-cche.org... Host unknown (Name server: squid-cche.org: host not found)
attached mail follows:
Adrian Chadd wrote:
> I drew some of this out on paper after I sent my last mail. To detect
> half-closed connections you read the FD and if EOF under certain
> conditions you want. You can't poll the fd since the FD will always
> return read ready. .. so yu need to do a read() and handle the
> return. What I was thinking about is to 'inject' data into a comm_read().
> That would be a neat solution. Got any other suggestions ?
You only need to detect this once. Then it is a known fact. You cannot
receive any more from that socket.
My suggesting is to simply have comm_read return EOF and then be done
with it. After that no further comm_read should be issued on that
filedescriptor, and should return EOF if attempted. comm_read should
never mark a EOF state filedescriptor for select.
For a binady data stream EOF is usually indicated by zero bytes of data
returned.
write will tell you if there are any error sending data out on the
socket, and getsockopt(..SO_ERROR) can be used to periodically poll the
socket for errors when there is no activity. Polling for an error only
useful if keep-alives are enabled or the client properly sends RESET
when aborting the connection (ABORT TCP operation, defined in Internet
Standard 6 but not covered in the "standard" sockets API).
/Henrik
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:27 MST