aionotify/aioutils.py
def _read_ready(self):
        """Called by the event loop whenever the fd is ready for reading."""

        try:
            data = os.read(self._fileno, self.max_size)
        except InterruptedError:
            # No worries ;)
            pass
        except OSError as exc:
            # Some OS-level problem, crash.
            self._fatal_error(exc, "Fatal read error on file descriptor read")
        else:
            if data:
                self._protocol.data_received(data)
            else:
                # We reached end-of-file.
                if self._loop.get_debug():
                    logger.info("%r was closed by the kernel", self)
                self._closing = False
                self.pause_reading()
                self._loop.call_soon(self._protocol.eof_received)
                self._loop.call_soon(self._call_connection_lost, None)
def _read_ready(self):
        """Called by the event loop whenever the fd is ready for reading."""

        try:
            data = os.read(self._fileno, self.max_size)
        except InterruptedError:
            # No worries ;)
            pass
        except OSError as exc:
            # Some OS-level problem, crash.
            self._fatal_error(exc, "Fatal read error on file descriptor read")
        else:
            if data:
                self._protocol.data_received(data)
            else:
                # We reached end-of-file.
                if self._loop.get_debug():
                    logger.info("%r was closed by the kernel", self)
                self._closing = False
                self.pause_reading()
                self._loop.call_soon(self._protocol.eof_received)
                self._loop.call_soon(self._call_connection_lost, None)
Called by the event loop whenever the fd is ready for reading.