Drain all writers to create some backpressure. We won't continue reading until there's space available in our write buffers, so if we cannot write fast enough our own read buffers run full and the TCP recv stream is throttled.
(self)
| 328 | raise cancelled |
| 329 | |
| 330 | async def drain_writers(self): |
| 331 | """ |
| 332 | Drain all writers to create some backpressure. We won't continue reading until there's space available in our |
| 333 | write buffers, so if we cannot write fast enough our own read buffers run full and the TCP recv stream is throttled. |
| 334 | """ |
| 335 | async with self._drain_lock: |
| 336 | for transport in list(self.transports.values()): |
| 337 | if transport.writer is not None: |
| 338 | try: |
| 339 | await transport.writer.drain() |
| 340 | except OSError as e: |
| 341 | if transport.handler is not None: |
| 342 | transport.handler.cancel(f"Error sending data: {e}") |
| 343 | |
| 344 | async def on_timeout(self) -> None: |
| 345 | try: |
no test coverage detected