I wrote:
> While testing this I discovered a pre-existing bug in the Unix
> implementation of WaitLatchOrSocket: EOF on the socket is reported as
> POLLHUP not POLLIN (at least on my Linux box), which results in
> WaitLatchOrSocket going into an infinite loop, because poll() returns
> immediately but the result bitmask never becomes nonzero.
BTW, I just came across this in Microsoft's documentation of
WSAEventSelect:
Note that Windows Sockets will record only an FD_CLOSE network eventto indicate closure of a virtual circuit. It will
notrecord anFD_READ network event to indicate this condition.
which seems to me to indicate that the Windows version of
WaitLatchOrSocket has a related bug. We want socket EOF to result in
WL_SOCKET_READABLE being returned, no? Otherwise the caller may never
realize that it has an EOF condition to deal with.
regards, tom lane