def _remove_bad(self): for fd in self._rfd | self._wfd | self._efd: try: _selectf([fd], [], [], 0) except (_selecterr, socket.error) as exc: if get_errno(exc) in SELECT_BAD_FD: self.unregister(fd)
def _poll(self, timeout): try: read, write, error = _selectf( self._rfd, self._wfd, self._efd, timeout, ) except (_selecterr, socket.error) as exc: if get_errno(exc) == errno.EINTR: return elif get_errno(exc) in SELECT_BAD_FD: return self._remove_bad() raise events = {} for fd in read: if not isinstance(fd, int): fd = fd.fileno() events[fd] = events.get(fd, 0) | READ for fd in write: if not isinstance(fd, int): fd = fd.fileno() events[fd] = events.get(fd, 0) | WRITE for fd in error: if not isinstance(fd, int): fd = fd.fileno() events[fd] = events.get(fd, 0) | ERR return list(events.items())
def _poll(self, timeout): try: read, write, error = _selectf( self._rfd, self._wfd, self._efd, timeout, ) except (_selecterr, socket.error), exc: if get_errno(exc) == errno.EINTR: return elif get_errno(exc) in SELECT_BAD_FD: return self._remove_bad() raise
def _poll(self, timeout): read, write, error = _selectf(self._rfd, self._wfd, self._efd, timeout) events = {} for fd in read: if not isinstance(fd, int): fd = fd.fileno() events[fd] = events.get(fd, 0) | READ for fd in write: if not isinstance(fd, int): fd = fd.fileno() events[fd] = events.get(fd, 0) | WRITE for fd in error: if not isinstance(fd, int): fd = fd.fileno() events[fd] = events.get(fd, 0) | ERR return list(events.items())
def _poll(self, timeout): read, write, error = _selectf(self._rfd, self._wfd, self._efd, timeout) events = {} for fd in read: if not isinstance(fd, int): fd = fd.fileno() events[fd] = events.get(fd, 0) | READ for fd in write: if not isinstance(fd, int): fd = fd.fileno() events[fd] = events.get(fd, 0) | WRITE for fd in error: if not isinstance(fd, int): fd = fd.fileno() events[fd] = events.get(fd, 0) | ERR return events.items()