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