On Wed, 15 Mar 2000, Alex Korobka wrote:
> How about this
>
> a) Don't set FD_CLOSE in sock->pmask on POLLHUP for normal data flow
> if recv( ..., MSG_PEEK) returns > 0. Disable polling for this socket.
Postponing FD_CLOSE until all data has been read out may be a good idea,
I'm just not sure whether that's what Windows does.
> b) In the reenabler for FD_READ event, if WS_FD_CONNECTED is missing,
> FD_CLOSE is not present in sock->pmask and recv( ..., MSG_PEEK)
> returns zero or less then set sock->pmask to FD_CLOSE and do
> set_event(sock->event) to deliver it.
Don't think so, unconnected datagram sockets should preferably work too.
(I also think poll() may be prettier than MSG_PEEK.)
If we do it Alexandre's way, perhaps we could add an explicit poll() call
in sock_reselect, it'd still return POLLIN | POLLHUP when there's data,
and so it could just call sock_poll_event() with that...