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

Method loop_accept_pipe

Lib/asyncio/windows_events.py:349–392  ·  view source on GitHub ↗
(f=None)

Source from the content-addressed store, hash-verified

347 server = PipeServer(address)
348
349 def loop_accept_pipe(f=None):
350 pipe = None
351 try:
352 if f:
353 pipe = f.result()
354 server._free_instances.discard(pipe)
355
356 if server.closed():
357 # A client connected before the server was closed:
358 # drop the client (close the pipe) and exit
359 pipe.close()
360 return
361
362 protocol = protocol_factory()
363 self._make_duplex_pipe_transport(
364 pipe, protocol, extra={'addr': address})
365
366 pipe = server._get_unconnected_pipe()
367 if pipe is None:
368 return
369
370 f = self._proactor.accept_pipe(pipe)
371 except BrokenPipeError:
372 if pipe and pipe.fileno() != -1:
373 pipe.close()
374 self.call_soon(loop_accept_pipe)
375 except OSError as exc:
376 if pipe and pipe.fileno() != -1:
377 self.call_exception_handler({
378 'message': 'Pipe accept failed',
379 'exception': exc,
380 'pipe': pipe,
381 })
382 pipe.close()
383 elif self._debug:
384 logger.warning("Accept pipe failed on pipe %r",
385 pipe, exc_info=True)
386 self.call_soon(loop_accept_pipe)
387 except exceptions.CancelledError:
388 if pipe:
389 pipe.close()
390 else:
391 server._accept_pipe_future = f
392 f.add_done_callback(loop_accept_pipe)
393
394 self.call_soon(loop_accept_pipe)
395 return [server]

Callers

nothing calls this directly

Calls 12

_get_unconnected_pipeMethod · 0.80
accept_pipeMethod · 0.80
resultMethod · 0.45
discardMethod · 0.45
closedMethod · 0.45
closeMethod · 0.45
filenoMethod · 0.45
call_soonMethod · 0.45
warningMethod · 0.45
add_done_callbackMethod · 0.45

Tested by

no test coverage detected