MCPcopy Create free account
hub / github.com/EasyIME/PIME / _try_inline_read

Method _try_inline_read

python/python3/tornado/iostream.py:831–851  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 5

read_until_regexMethod · 0.95
read_untilMethod · 0.95
read_bytesMethod · 0.95
read_intoMethod · 0.95
read_until_closeMethod · 0.95

Calls 6

_find_read_posMethod · 0.95
_read_from_bufferMethod · 0.95
_check_closedMethod · 0.95
_read_to_buffer_loopMethod · 0.95
closedMethod · 0.95
_add_io_stateMethod · 0.95

Tested by

no test coverage detected