summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-09-22 02:53:46 +0300
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2016-09-22 14:55:01 -0700
commit7ff8a74945c0cb525a2d197e28426fd098a407cf (patch)
tree5020ed9187f951e0a33e60d6f33f6422d7fc7ec3 /os
parent1d365f1ffe0362732b64e565db6ae8af718758f2 (diff)
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>
Diffstat (limited to 'os')
-rw-r--r--os/ospoll.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/os/ospoll.c b/os/ospoll.c
index b00d42202..51bd02dc7 100644
--- a/os/ospoll.c
+++ b/os/ospoll.c
@@ -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
}
}