MCPcopy
hub / github.com/benoitc/gunicorn / _close_transport

Method _close_transport

gunicorn/asgi/protocol.py:1450–1464  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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."""

Callers 5

_handle_h1c_exceptionMethod · 0.95
_feed_callback_parserMethod · 0.95
_keepalive_timeoutMethod · 0.95
_handle_connectionMethod · 0.95

Calls 2

can_write_eofMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected