os: Clear saved poll events in listen so that edge triggering works

When a client is marked as write blocked, clear any old 'write ready'
bit in the osfds structure so that a new indication of write ready
(which is marked as edge trigggered) will trigger the callback.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Tested-by: Matthieu Herrb <matthieu@herrb.eu>
This commit is contained in:
Keith Packard 2016-09-22 02:53:46 +03:00 committed by Jeremy Huddleston Sequoia
parent 1d365f1ffe
commit 7ff8a74945

View File

@ -352,10 +352,14 @@ ospoll_listen(struct ospoll *ospoll, int fd, int xevents)
epoll_mod(ospoll, osfd);
#endif
#if POLL
if (xevents & X_NOTIFY_READ)
if (xevents & X_NOTIFY_READ) {
ospoll->fds[pos].events |= POLLIN;
if (xevents & X_NOTIFY_WRITE)
ospoll->osfds[pos].revents &= ~POLLIN;
}
if (xevents & X_NOTIFY_WRITE) {
ospoll->fds[pos].events |= POLLOUT;
ospoll->osfds[pos].revents &= ~POLLOUT;
}
#endif
}
}