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

Method _accept_connection2

Lib/asyncio/selector_events.py:219–265  ·  view source on GitHub ↗
(
            self, protocol_factory, conn, extra,
            sslcontext=None, server=None,
            ssl_handshake_timeout=constants.SSL_HANDSHAKE_TIMEOUT,
            ssl_shutdown_timeout=constants.SSL_SHUTDOWN_TIMEOUT, context=None)

Source from the content-addressed store, hash-verified

217 self.create_task(accept, context=conn_context)
218
219 async def _accept_connection2(
220 self, protocol_factory, conn, extra,
221 sslcontext=None, server=None,
222 ssl_handshake_timeout=constants.SSL_HANDSHAKE_TIMEOUT,
223 ssl_shutdown_timeout=constants.SSL_SHUTDOWN_TIMEOUT, context=None):
224 protocol = None
225 transport = None
226 try:
227 protocol = protocol_factory()
228 waiter = self.create_future()
229 if sslcontext:
230 transport = self._make_ssl_transport(
231 conn, protocol, sslcontext, waiter=waiter,
232 server_side=True, extra=extra, server=server,
233 ssl_handshake_timeout=ssl_handshake_timeout,
234 ssl_shutdown_timeout=ssl_shutdown_timeout,
235 context=context)
236 else:
237 transport = self._make_socket_transport(
238 conn, protocol, waiter=waiter, extra=extra,
239 server=server, context=context)
240
241 try:
242 await waiter
243 except BaseException:
244 transport.close()
245 # gh-109534: When an exception is raised by the SSLProtocol object the
246 # exception set in this future can keep the protocol object alive and
247 # cause a reference cycle.
248 waiter = None
249 raise
250 # It's now up to the protocol to handle the connection.
251
252 except (SystemExit, KeyboardInterrupt):
253 raise
254 except BaseException as exc:
255 if self._debug:
256 context = {
257 'message':
258 'Error on transport creation for incoming connection',
259 'exception': exc,
260 }
261 if protocol is not None:
262 context['protocol'] = protocol
263 if transport is not None:
264 context['transport'] = transport
265 self.call_exception_handler(context)
266
267 def _ensure_fd_no_transport(self, fd):
268 fileno = fd

Callers 1

_accept_connectionMethod · 0.95

Calls 5

_make_ssl_transportMethod · 0.95
create_futureMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected