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

Method start_tls

Lib/asyncio/streams.py:386–400  ·  view source on GitHub ↗

Upgrade an existing stream-based connection to TLS.

(self, sslcontext, *,
                        server_hostname=None,
                        ssl_handshake_timeout=None,
                        ssl_shutdown_timeout=None)

Source from the content-addressed store, hash-verified

384 await self._protocol._drain_helper()
385
386 async def start_tls(self, sslcontext, *,
387 server_hostname=None,
388 ssl_handshake_timeout=None,
389 ssl_shutdown_timeout=None):
390 """Upgrade an existing stream-based connection to TLS."""
391 server_side = self._protocol._client_connected_cb is not None
392 protocol = self._protocol
393 await self.drain()
394 new_transport = await self._loop.start_tls( # type: ignore
395 self._transport, protocol, sslcontext,
396 server_side=server_side, server_hostname=server_hostname,
397 ssl_handshake_timeout=ssl_handshake_timeout,
398 ssl_shutdown_timeout=ssl_shutdown_timeout)
399 self._transport = new_transport
400 protocol._replace_transport(new_transport)
401
402 def __del__(self, warnings=warnings):
403 if not self._transport.is_closing():

Callers

nothing calls this directly

Calls 2

drainMethod · 0.95
_replace_transportMethod · 0.80

Tested by

no test coverage detected