MCPcopy Index your code
hub / github.com/python/cpython / _control_app_writing

Method _control_app_writing

Lib/asyncio/sslproto.py:823–850  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

821 # Flow control for writes from APP socket
822
823 def _control_app_writing(self):
824 size = self._get_write_buffer_size()
825 if size >= self._outgoing_high_water and not self._app_writing_paused:
826 self._app_writing_paused = True
827 try:
828 self._app_protocol.pause_writing()
829 except (KeyboardInterrupt, SystemExit):
830 raise
831 except BaseException as exc:
832 self._loop.call_exception_handler({
833 'message': 'protocol.pause_writing() failed',
834 'exception': exc,
835 'transport': self._app_transport,
836 'protocol': self,
837 })
838 elif size <= self._outgoing_low_water and self._app_writing_paused:
839 self._app_writing_paused = False
840 try:
841 self._app_protocol.resume_writing()
842 except (KeyboardInterrupt, SystemExit):
843 raise
844 except BaseException as exc:
845 self._loop.call_exception_handler({
846 'message': 'protocol.resume_writing() failed',
847 'exception': exc,
848 'transport': self._app_transport,
849 'protocol': self,
850 })
851
852 def _get_write_buffer_size(self):
853 return self._outgoing.pending + self._write_buffer_size

Callers 2

_process_outgoingMethod · 0.95

Calls 4

pause_writingMethod · 0.45
resume_writingMethod · 0.45

Tested by

no test coverage detected