Flush the write buffer. The intended use is to write w.write(data) await w.drain()
(self)
| 359 | return self._transport.get_extra_info(name, default) |
| 360 | |
| 361 | async def drain(self): |
| 362 | """Flush the write buffer. |
| 363 | |
| 364 | The intended use is to write |
| 365 | |
| 366 | w.write(data) |
| 367 | await w.drain() |
| 368 | """ |
| 369 | if self._reader is not None: |
| 370 | exc = self._reader.exception() |
| 371 | if exc is not None: |
| 372 | raise exc |
| 373 | if self._transport.is_closing(): |
| 374 | # Wait for protocol.connection_lost() call |
| 375 | # Raise connection closing error if any, |
| 376 | # ConnectionResetError otherwise |
| 377 | # Yield to the event loop so connection_lost() may be |
| 378 | # called. Without this, _drain_helper() would return |
| 379 | # immediately, and code that calls |
| 380 | # write(...); await drain() |
| 381 | # in a loop would never call connection_lost(), so it |
| 382 | # would not see an error when the socket is closed. |
| 383 | await sleep(0) |
| 384 | await self._protocol._drain_helper() |
| 385 | |
| 386 | async def start_tls(self, sslcontext, *, |
| 387 | server_hostname=None, |