Attempt to complete the current read operation from buffered data. If the read can be completed without blocking, schedules the read callback on the next IOLoop iteration; otherwise starts listening for reads on the socket.
(self)
| 821 | self._maybe_add_error_listener() |
| 822 | |
| 823 | def _try_inline_read(self) -> None: |
| 824 | """Attempt to complete the current read operation from buffered data. |
| 825 | |
| 826 | If the read can be completed without blocking, schedules the |
| 827 | read callback on the next IOLoop iteration; otherwise starts |
| 828 | listening for reads on the socket. |
| 829 | """ |
| 830 | # See if we've already got the data from a previous read |
| 831 | pos = self._find_read_pos() |
| 832 | if pos is not None: |
| 833 | self._read_from_buffer(pos) |
| 834 | return |
| 835 | self._check_closed() |
| 836 | pos = self._read_to_buffer_loop() |
| 837 | if pos is not None: |
| 838 | self._read_from_buffer(pos) |
| 839 | return |
| 840 | # We couldn't satisfy the read inline, so make sure we're |
| 841 | # listening for new data unless the stream is closed. |
| 842 | if not self.closed(): |
| 843 | self._add_io_state(ioloop.IOLoop.READ) |
| 844 | |
| 845 | def _read_to_buffer(self) -> Optional[int]: |
| 846 | """Reads from the socket and appends the result to the read buffer. |
no test coverage detected