On Thu, 16 Mar 2000, Ove Kaaven wrote:

> 
> 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.
>

  I'm pretty sure this is what is written in MSDN docs - no FD_CLOSE until
  all the data has been read. At least for SOCK_STREAM connections.

Alex
 
> >   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.)

  Hm, true. How about adding WS_FD_CLOSING flag that is set when we
  receive POLLHUP? 

Alex

> 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...
> 

Reply via email to