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

Method wait_closed

Lib/asyncio/base_events.py:393–418  ·  view source on GitHub ↗

Wait until server is closed and all connections are dropped. - If the server is not closed, wait. - If it is closed, but there are still active connections, wait. Anyone waiting here will be unblocked once both conditions (server is closed and all connections have b

(self)

Source from the content-addressed store, hash-verified

391 self._serving_forever_fut = None
392
393 async def wait_closed(self):
394 """Wait until server is closed and all connections are dropped.
395
396 - If the server is not closed, wait.
397 - If it is closed, but there are still active connections, wait.
398
399 Anyone waiting here will be unblocked once both conditions
400 (server is closed and all connections have been dropped)
401 have become true, in either order.
402
403 Historical note: In 3.11 and before, this was broken, returning
404 immediately if the server was already closed, even if there
405 were still active connections. An attempted fix in 3.12.0 was
406 still broken, returning immediately if the server was still
407 open and there were no active connections. Hopefully in 3.12.1
408 we have it right.
409 """
410 # Waiters are unblocked by self._wakeup(), which is called
411 # from two places: self.close() and self._detach(), but only
412 # when both conditions have become true. To signal that this
413 # has happened, self._wakeup() sets self._waiters to None.
414 if self._waiters is None:
415 return
416 waiter = self._loop.create_future()
417 self._waiters.append(waiter)
418 await waiter
419
420
421class BaseEventLoop(events.AbstractEventLoop):

Callers 1

serve_foreverMethod · 0.95

Calls 2

create_futureMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected