Close the transport safely. Calls write_eof() first if supported to signal end of writing, which helps ensure buffered data is flushed before closing.
(self)
| 1448 | return reasons.get(status, "Unknown") |
| 1449 | |
| 1450 | def _close_transport(self): |
| 1451 | """Close the transport safely. |
| 1452 | |
| 1453 | Calls write_eof() first if supported to signal end of writing, |
| 1454 | which helps ensure buffered data is flushed before closing. |
| 1455 | """ |
| 1456 | if self.transport and not self._closed: |
| 1457 | try: |
| 1458 | # Signal end of writing to help flush buffers |
| 1459 | if self.transport.can_write_eof(): |
| 1460 | self.transport.write_eof() |
| 1461 | self.transport.close() |
| 1462 | except Exception: |
| 1463 | pass |
| 1464 | self._closed = True |
| 1465 | |
| 1466 | async def _handle_http2_connection(self, transport, ssl_object): |
| 1467 | """Handle an HTTP/2 connection.""" |
no test coverage detected