Mike Kaplinskiy mike.kaplinskiy@gmail.com writes:
But I see your point that perhaps it doesn't belong in the main loop when one of the halves gets closed. I guess we can keep sock_try_event around but only use it when the socket has been removed from the main loop. I'll also add detection of half-closed connection and drop that event if the other half hasn't hung up yet. Sadly looks like MacOS will be left out of that detection since it reports POLLIN|POLLHUP for everything.
Does that sound good?
I think sock_try_event shouldn't even do a poll() at all. Once we have received POLLHUP there's no point in continuing to poll. All it should have to do is try a MSG_PEEK read to detect EOF for platforms where that triggers a POLLHUP. All other cases should be handled by the main loop.