How to use the select26.KQ_FILTER_READ function in select26

To help you get started, we’ve selected a few select26 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apple / ccs-calendarserver / kqreactor.py View on Github external
def _doWriteOrRead(self, selectable, fd, event):
        why = None
        inRead = False
        filter, flags, data, fflags = event.filter, event.flags, event.data, event.fflags
        if flags & KQ_EV_EOF and data and fflags:
            why = main.CONNECTION_LOST
        else:
            try:
                if filter == KQ_FILTER_READ:
                    inRead = True
                    why = selectable.doRead()
                if filter == KQ_FILTER_WRITE:
                    inRead = False
                    why = selectable.doWrite()
                if not selectable.fileno() == fd:
                    inRead = False
                    why = main.CONNECTION_LOST
            except:
                log.err()
                why = sys.exc_info()[1]

        if why:
            self._disconnectSelectable(selectable, why, inRead)

select26

Backport of the new select module with epoll and kqueue interface

MIT
Latest version published 16 years ago

Package Health Score

42 / 100
Full package analysis

Similar packages