From 6d18ce81d8808425e34e94370a93bcce0c0c1640 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 15 May 2018 01:49:03 +0100 Subject: [PATCH] issue #249: restore duplex behaviour for epoll With epoll() there is only one kernel-side object per file descriptor, which is why _control() is such a pain. Since we merge receive/transmit watching into that single object, we must always test the mask for both conditions when reading results. Kqueue isn't/doesn't appear to be like this. The identity of a Kqueue event is keyed on (fd, filter), and we register a separate event for both transmit and receive, so the 'elif' in KqueuePoller.poll() does not appear to need to change. Previously, a FD marked for read+write would not indicate writeability until it was no longer readable. --- mitogen/parent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mitogen/parent.py b/mitogen/parent.py index 693a82b7..089d8603 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -647,7 +647,7 @@ class EpollPoller(Poller): # Events can still be read for an already-discarded fd. mitogen.core._vv and IOLOG.debug('%r: POLLIN: %r', self, fd) yield self._rfds[fd] - elif event & select.EPOLLOUT and fd in self._wfds: + if event & select.EPOLLOUT and fd in self._wfds: mitogen.core._vv and IOLOG.debug('%r: POLLOUT: %r', self, fd) yield self._wfds[fd]