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